
My Favorite Shortcuts for JetBrains' IDEs - Sukram21
https://www.markusdosch.com/2020/04/my-favorite-shortcuts-for-jetbrains-ides/
======
albertzeyer
While we talk about JetBrains, I think they really should push some priority
on their remote development support. Take the VS Code Remote SSH extension as
a good example of how it could work, which is extremely seamlessly, and it
just works. E.g. even the embedded terminal provides a shell on the remote
host, and if you e.g. open a file in there via `code somefile.txt`, it will
open in your VS Code.

It's basically this feature request:
[https://youtrack.jetbrains.com/issue/IDEA-226455](https://youtrack.jetbrains.com/issue/IDEA-226455)

Maybe they just need a few more votes on it. Or some more popularity.

Or is it just me and most people don't really need this? I'm still not really
sure about the optimal remote work setup. Other people might just use Mosh +
Tmux + Vim... I heard that Google has some very nice internal web IDE. If
there would be a web IDE as powerful as PyCharm and the other JetBrain IDEs,
that would also be a nice option.

~~~
LeonM
FWIW: In the 2020.1 updates that have been rolled out in the last week the SSH
support is now much better.

But serious question though: what workflow do you have that remote code
editing is necessary?

~~~
101101001010
I find remote code editing to be useful when I don't have the necessary
resources on my machine such as disk/memory/gpu and I am still prototyping a
solution, which happens a lot in ML/DL.

I agree that remote code editing is not strictly necessary since you can
perform such task with sshfs or git push/pull workflows.

On the other hand, having the remote environment in your local IDE quickens
the development and you don't have to setup a full replica of your environment
locally.

edit: ML/DL here stands for Machine Learning/Deep Learning

~~~
heroprotagonist
I get that through remote interpreter and automatic upload features.

------
thewisenerd
A couple of "problems" I've had with Jetbrains' (more specifically IntelliJ
IDEA's) shortcuts are:

\- Not everybody uses a "standard" set of shortcuts (understandable); so
whenever I need to do something on another's system, unless they're on
"IntelliJ IDEA Classic" keymap, I'm clueless for a while.

\- Not wanting to re-learn the "default" (shipped with) "macOS" keymap in case
they change it again because of clashes with system shortcuts

\- When switching to Linux (when my MBP just decides to limit all cores to
0.8GHz for thermals and I can get no work done), I have no idea what shortcuts
are there. It's a hit-and-miss, hoping Cmd maps to Alt and it's the same
combination. If it were possible to replicate the entirety of the Apple keymap
on Linux, I'd switch to using IntelliJ IDEA on my beefier linux machine in an
instant. (Oh and if there's a terminal configurable such that I can set up
iTerm's shortcuts, bliss!)

\- "complex" shortcuts, like Cmd-Shift-Option-N; afraid to remap it to
something (moreso, figuring out what'd be the best remap option), afraid to
hurt my little-finger the more I use that.

~~~
MasterScrat
FYI you can export your shortcuts (and other settings):
[https://www.jetbrains.com/help/idea/sharing-your-ide-
setting...](https://www.jetbrains.com/help/idea/sharing-your-ide-
settings.html)

------
LeonM
Ctrl-alt-L (cmd-alt-L) is my all-time favorite. It reformats the code
consistently. It's the first thing I do when I start work on a new codebase,
and the last thing I do before a commit.

No need for endless discussions on which style is best, as the IDE allows you
to set the preferences on a per-project basis. It can also read editor config
dotfiles so you can use code formatting consistently throughout a team.

~~~
wmfiv
A potential next step if it fits your workflow is to create a macro triggered
by save. I have one that optimizes imports, reformats code and do silent code
cleanup.

~~~
enitihas
There is already an intellij plugin called Save Actions which does this
(import, reformats, and some extra stuff, like adding final to variables
wherever possible(optional off course).

~~~
wmfiv
Oh that's nice! Thank you.

------
olejorgenb
`Ctrl+W` is awesome, but after it has been ingrained in the fingers it's easy
to close browser tabs by accident :D

Another one (not mentioned) is "Dobbel tap and hold Ctrl" to add multiple
carets using the arrow keys (might need to enable in settings (Under smart
keys)).

Another "smart keys" settings I recommend is "Surround selection on typing
quote or brace" (not sure it's default or not)

~~~
Stratoscope
> _Ctrl+W is awesome, but after it has been ingrained in the fingers it 's
> easy to close browser tabs by accident :D_

This is why Ctrl+Shift+T is my favorite browser shortcut!

------
_josh_
I recently installed the "Key Promoter X" plugin, which tells me the keyboard
shortcuts for things I do frequently with the mouse. Pretty handy.

------
danpalmer
The JetBrains IDEs implement their own raw keyboard event handling, which
means that if you have your system set up with a non-standard keyboard layout
and JetBrains hasn't implemented their own support, it just won't work.

The issue on their public issue tracker has been open for something like 8
years.

Unfortunately for me this means that no keyboard shortcuts using the Cmd key
work, despite me using a built-in macOS keyboard layout with no special
customisation.

~~~
enitihas
> despite me using a built-in macOS keyboard layout with no special
> customisation.

I also use a built-in macOS keyboard layout with no special customisation, and
I regularly use shortcuts with Cmd. Perhaps you might want to change your
Keymap in IntelliJ(this can be done by Double Shift -> Type Keymap -> Select
new value.

Edit: For me, almost all the shortcuts detailed in this post work, just need
to replace Ctrl with Cmd.

~~~
danpalmer
I'm using the Dvorak Cmd-QWERTY layout in macOS. This changes the layout to
QWERTY whilst the Cmd key is held so that keyboard shortcuts are mostly in the
same physical place (because most are about easy hand movements rather than
letter). JetBrains does not match this behaviour.

~~~
Splognosticus
Huh, never realized that was a thing. Do the shortcuts in the menu show the
QWERTY key or the Dvorak one? I'm curious how you learn the shortcuts if it
still shows the QWERTY keys.

~~~
danpalmer
Shortcuts all show the correct letter value. So for Ctrl+T, I'd press what is
the K key on a QWERTY keyboard. For Cmd+T, I'd press what is the T key on a
QWERTY keyboard.

This can get a little confusing, but most common shortcuts contain the Cmd
modifier on a Mac, so it's only really Terminal/iTerm where things are
different.

My keyboard is still physically a QWERTY keyboard which makes knowing where
Cmd shortcuts are very easy, I can just look. I switched to Dvorak when I was
18, but learnt with a Dvorak keyboard so I didn't learn it well enough and
when I got to uni and had to use shared lab machines I couldn't manage and had
to switch back. Then just over 3 years ago I had 3 weeks off work so switched
at the beginning with no physically different keyboards and learnt it all by
position and I'm still using it today. Less hand pain, and I can touch type
where before I was proficient but not entirely by touch.

------
koalaman
One of my favorites, which I didn't think to look for for years, is 'Ctrl +
Shift + Enter'. This completes your statement for you. Very convenient and
lots of wasted punctuation characters skipped.

~~~
i_dursun
My favorite too. I always remap that to shift+enter though.

------
enitihas
The best thing about this is the consistency across languages. Whether I am
writing Java,C++,Rust, Go,Javascript, the shortcuts are the same with similar
behaviour as much as possible. Shift F6 refactors the variable name. Cmd Alt M
refactors a method from a chunk of code. Being able to use this muscle memory
across languages is fantastic.

~~~
Stratoscope
> _Shift F6 refactors the variable name._

Funny you mention that. As a long-time Windows user, that is the first thing I
remap when I set up any JetBrains IDE. F2 is the rename shortcut in File
Explorer, so I set it to be the refactor variable name shortcut too.

------
plumbus420
I use the vim plugin and various jetbrains commands in IntelliJ.

Multi-cursor select is taken care of by vim's visual block. Basic
editing/macros/navigation within a single file also done with vim.

For more IDE/multi-file specific tasks I use IntelliJ's shortcuts:

* cmd+shift+f for global search

* 2xshift for symbol search

* cmd+b to jump to method declaration

* cmd+shift+left/right is also useful to jump to previously navigated cursors

refactoring:

* cmd+alt+v/c/m for extracting variable/constants/methods (good for refactoring after prototyping)

* shift+f6 for renaming variables

* alt+enter for suggestions

EDIT: formatting

------
canterburry
I've asked this before in other conversations but, what makes VS Code so
popular compared to more mature IDEs with a more full fledged set of features
like IntelliJ?

I have tried VS Code and the minute I couldn't ctrl + click navigate the code
or get contextual ctrl + space bar method or input parameter suggestions I
abandoned it.

~~~
h0l0cube
> I have tried VS Code and the minute I couldn't ctrl + click navigate the
> code or get contextual ctrl + space bar method or input parameter
> suggestions I abandoned it.

I'm using VSC for a project the moment. You can definitely Cmd+Click on Mac to
navigate, so I assume you could too, but perhaps it's not indexing your code
for some reason?

I also see completions for method parameters, but I don't yet know the
shortcut to redisplay it. Typing the opening brace, or a comma will display
it, however.

What I miss the most in VSC is a decent VIM emulator. A number of the
shortcuts in that list (and more) can be key combinations in Vim. But even
crucial things like search with /, *, #, and ? (find symbol and regex search
prev/next) aren't implemented properly, and undo/redo sometimes falls apart
and corrupts your code. I believe the emulation in JetBrains products are
actually made by the JB team themselves, so they can probably get all the
necessary hooks in the extension API for Vim to function properly.

~~~
hiq
Last I heard, they were embedding neovim in VS Code, have you tried this? Or
did they give up on this?

~~~
h0l0cube
Looks like it's a thing:

[https://marketplace.visualstudio.com/items?itemName=asvetlia...](https://marketplace.visualstudio.com/items?itemName=asvetliakov.vscode-
neovim)

When my annoyance at the vanilla Vim plugin exceeds my laziness to install and
configure Neovim, I'll have a look at it :) Thank you.

------
galaxyLogic
I think WebStorm has the problem that the keyboard shortcuts are more or less
meaningless key-combinations, it's difficult to remember them unless you use
them frequently.

Luckily you can reassign the functions to different keys. For instance I have
re-assigned "Show Breakpoints" to Ctrl-Break. Easy to remember right?

I re-assigned Ctrl-I to also Ctrl-E. Why? Because that Evaluates Expressions.

I've been using WebStorm for years now and I still discover useful stuff and
keyboard shortcuts in it. That is both great but also a sign of how it is not
completely obvious how to do things.

Recently I discovered what I think is the greatest shortcut of them all: Ctrl-
Tab.

That pops up a widget from which I can choose which tool-window to make
current. Keep the Ctrl down and you can use Tab or arrow-keys to navigate to
the tool-window-name you want to activate.

------
karmakaze
You forgot a huge timesaver. I can't remember the shortcut (maybe Ctrl+F6)
change method signature.

You can add a parameter and specify a default value that will be added to
every call site. You can also reorder parameters or delete one and all the
call sites will be updated.

------
karmakaze
Another favourite that I'd been missing since switching from Eclipse (back
around Eclipse 3.6/4.2 days) is Field Call Hierarchy. Cursor on a data element
and get the 'call hierarchy' from it.

Of course fields aren't 'called' per se, so JetBrains didn't do this. I'd been
promoting issue IDEA-160274 where ever I could and now you can cursor on a
field and press Ctrl+Alt+H (macOS) and see references to that field, and then
selectively expand those references in a caller tree.

[0]
[https://youtrack.jetbrains.com/issue/IDEA-160274](https://youtrack.jetbrains.com/issue/IDEA-160274)

------
urineaut
Ctrl + Shift + A is my favourite shortcut in JetBrain IDEs. Having all editor
commands in one go without the need to click through menus is a bliss.
Especially so because I don't use IDEs as regular as Neovim and thus keep
forgetting some shortcuts.

Double Shift is also extremely helpful to navigate to a file if the project
has a lot of nested subdirectories.

------
atulatul
Here's a video showing top 15 IntelliJ shortcuts by Trisha Gee. I know it's
like watching top 15 Federer shots. Some of your favorites may not be there.
Still it's quite good.

[https://www.youtube.com/watch?v=QYO5_riePOQ](https://www.youtube.com/watch?v=QYO5_riePOQ)

------
ungawatkt
Alt-shift-arrow up/down for creating more cursors above/below. Easy multi-line
editing (I may have set that up manually, but I do it in every ide now if it's
not by default)

Ctrl-Q opens documentation, which you can pin as a tool window.

------
GGfpc
One of the best things I did now that I work on a Mac was use the force touch
trackpad to ctrl-click whenever I push harder and a custom gesture for
forwards and backwards.

------
ravedave5
I really wish they had ctrl-shift-t - reopen tab. I use it in chrome so much
and it kills me when I accidentally close a file and I can't just reopen.

~~~
tekseven
They have a "Reopen Closed Tab" action you can map in Settings -> Keymap. You
can also use "Recent Locations" Ctrl-Shift-E to see recently touched files,
the first one will be the one you just closed.

------
jakobov
You know what the best shortcut is?

The menu key (windows and linux only)

Want to fix spelling of a word? Press menu key Want to refactor? Press menu
key

You name it... press the menu key.

------
cryptos
While we are at it: Does anyone know how to hide the new commit view? I
haven't found a related action I could assign a shortcut to.

~~~
avisser
In the Keymap editor, Tool Windows -> Commit

~~~
cryptos
Thanks, it works.

------
caseyw
Ctrl+J to select multiple occurrences for editing. That works for me on Linux.
I think it’s different on Windows/Mac.

~~~
narcindin
Ctrl + G is select multiple occurrences on Mac.

It's one of my favorites as well. It is really good when you need to quickly
rename, reformat or tweak a handful of lines that isn't a viable refactor
action.

------
marmalar
ctrl+Up: selects increasingly larger scopes, great for selecting the content
of a string literal (either with or without the quotes) or grabbing chunks of
call chain

------
bronlund
One of my absolute favorites is multi-cursor editing. I first stumbled upon
this in Sublime Text, but now I can´t live without it.

