My JetBrains IDE shortcuts
In the JetBrains IDEs, the “Default for macOS” keymap isn’t doesn’t feel very Mac-like to me, especially for keyboard navigation in particular. Apple provides details of the keyboard shortcuts you can expect to work in a Mac application, so these are the changes that I’ve made to make PhpStorm and PyCharm feel more at home on my Mac:
Open Preferences and select Keymap from the left hand side. Then select “Default for macOS”, click the gear icon and duplicate it. Rather unimaginatively, the name I use is “RKA Default for macOS”.
Add the Mac-like shortcuts
Add these key mappings to match the standard system-wide shortcuts:
- Main menu -> Edit -> Find -> Find Word at Caret: ⌘E
- Editor Actions -> Move Caret to Text End: ⌘↓
- Editor Actions -> Move Caret to Text End with Selection: ⇧⌘↓
- Editor Actions -> Move Caret to Text Start: ⌘↑
- Editor Actions -> Move Caret to Text Start with Selection: ⇧⌘↑
- Main menu -> File -> Close Project: ⇧⌘W
Cmd+e to add the current selection to the find buffer is my favourite system wide macOS shortcut as I can press cmd+e, cmd+g to find next occurrence of something in pretty much every application. The JetBrains IDEs can’t quite match this, so I set cmd+e to the next best thing. Then we have moving to the top and bottom of a document which should be on cmd+up and cmd+down (along with holding shift to select while moving). Finally on a Mac you close any window full of tabs with shift+cmd+w, so in an IDE, this means closing the project.
Adding these mappings means that some other commands no longer have a keyboard shortcut. This is what I reassigned them to:
- Main menu -> Code -> Move Statement Down: ⌥⇧⌘↓
- Main menu -> Code -> Move Statement Up: ⌥⇧⌘↑
For moving a statement up and down I added option to the standard JetBrains choice, though to be honest, I rarely use this and am more likely to select the relevant lines and use Move Line Up/Move Line Down instead.
Note that two other commands already had alternatives: Jump to Navigation Bar has ⌥↖︎ already assigned as an alternative and Jump to Source has F4 as its alternative, so I just use those. Note that ↖︎ is fn+left arrow on laptop-like keyboards.
Other convenient shortcuts
Additionally, I also have these set for my convenience as they match other apps I use or just make sense to my fingers:
- Main menu -> Code -> Move Line Down: ^⌘↓
- Main menu -> Code -> Move Line up: ^⌘↑
- Main menu -> Window -> Select Next Tab: ⇧⌘]
- Main menu -> Window -> Select Previous Tab: ⇧⌘[
- Main menu -> Window -> Split and Move Right: ⌘K,⌘↑
- Main menu -> Window -> Unsplit: ⌘K,⌘↓
- Editor Actions -> Clone Caret Above: ^⇧↑
- Editor Actions -> Clone Caret Below: ^⇧↓
- Editor Actions -> Move Caret to Next Word in Different “CamelHumps” Mode: ^→
- Editor Actions -> Move Caret to Next Word with Selection in Different “CamelHumps” Mode: ^⇧→
- Editor Actions -> Move Caret to Next Word in Different “CamelHumps” Mode: ^←
- Editor Actions -> Move Caret to Next Word with Selection in Different “CamelHumps” Mode: ^⇧←
- Other -> Select in Project View: ⇧⌘1
- Plug-ins -> GitHub -> Open on GitHub: ^⇧O
(I’ve noted them here so that I have a reference for when I get around to looking at GoLand!)
As someone who uses a variety of Mac apps to enter text, it’s very strange to come across one where some of the standard keyboard shortcuts don’t work as they “should” for the operating system. Changing the JetBrains IDEs to match my fingers expectations makes it much more pleasant and less jarring to use these them.