I organize keyboard shortcuts into 4 categories:
HJKL
with ⌘⌥⌃⇧
modifiers.
- Vim Leader Key mappings.
- Vim commands. e.g.
⌃ + w
for window managment.
- Standard shortcuts, e.g.,
⌘ + t
to create a new tab and ⌘ + w
to close one.
Not only does it allow me to remember over 200 keyboard shortcuts,
but it also lets me work (almost) the same way across editors:
WebStorm (and other JetBrains IDEs) with
IdeaVim plugin:
VSCode with
VSCodeVim
extension:
Zed with built-in Vim Mode :
HJKL with Modifiers
HJKL
are not only ←↓↑→
for Vim. I use them with modifiers for any directional actions like moving,
scrolling, navigating back/forward, tc.
In Vim ⇧ + j
join lines. I remapped ⌃ + y
for it instead.
⇧ + j
Scroll down by one line ⇧ + k
Scroll up by one line
Move cursor up/down in window
Via Vim. Also ⇧ + m
for moving cursor to the middle.
⇧ + h
Move cursor to window top ⇧ + l
Move cursor to window bottom
Move cursor up/down in file
⌃ + j
Move cursor down by 5 lines ⌃ + k
Move cursor up by 5 lines
Go back/forward in history
Find/Select word under cursor
⌘ + j
Find next word under cursor ⌘ + k
Find previous word under cursor
Expand/Shrink selection
Previous/Next tab
Move line up/down
Move statement up/down/left/right
⌃⇧ + j
Move statement down ⌃⇧ + h
Move statement left ⌃⇧ + l
Move statement right
Go to next/previous error in file
⌥⌃ + j
Go to next error in file ⌥⌃ + k
Go to previous error in file
Go to next/previous method in file
⌘⌥ + j
Go to next method in file ⌘⌥ + k
Go to previous method in file
Go to next/previous change in file/diff
⌘⌃ + j
Go to next change in file ⌘⌃ + k
Go to previous change in file
Go to next/previous file in diff
⌘⌃ + h
Go to next file in diff ⌘⌃ + l
Go to previous file in diff
Add cursor below/above
Tab switcher
⌘⌥⌃ + h
Tab switcher backward ⌘⌥⌃ + l
Tab switcher forward
Leader Key Mappings
I use space
(␣
) as leader key, and use each letter for a category, e.g. f
for Find
.
a - Switch case
( WebStorm with String Manipulation plugin.)
␣aS
To SCREAMING_SNAKE_CASE
c - Code / Completion
␣cC
Smart type completion ␣ct
Insert live template / snippet
d - Doc / Info / Peek
␣de
Show error description ␣di
Quick implementations
e - Execution / Run / Debug
␣␣e
Choose run configuration ␣␣E
Choose debug configuration ␣ee
Edit run configurations
f - Find / Search
␣fa
Find action / command palette ␣fk
Find recent changed file ␣ft
Find text in all files
j - Jump / Goto code
␣jD
Goto declaration split ␣jI
Goto implementation split ␣jm
Goto member of file Structure ␣jt
Goto type declaration ␣jT
Goto type declaration split ␣jU
Show usages in find panel
k - Refactor
I use k as it is at home row and I use refactors a lot.
I use l as it is at home row and I often need to toggle tool windows.
␣␣l
Hide all tool windows
n - New / Generate
r - Replace
s - Source control
( VSCode with GitLens extention.)
␣sC
Toggle amend commit mode ␣sF
Show all affected files ␣sH
Show local file history ␣sl
Rollback changed lines ␣sN
Create new pull request ␣su
Update project / pull
v - View
␣vG
Show gutter icons settings ␣vw
Toggle use soft wraps
x - Close / Hide / Delete
␣xn
Close all notifications
y - Yank / Copy
␣yl
Copy path with line number ␣yp
Copy content root path ␣yP
Copy path from repository root
z - Editor Settings
Other Keyboard Shortcuts
Some other keyboard shortcuts in addition to Vim and standard commands:
Quick editor actions
␣⏎
Show intention actions or quick fix gs
Select file in project view ⌘ + d
Duplicate lines down
Back to the editor
To use the Vim (leader) key bindings, it is crucial to focus back on the editor.
⌘ + ⎋
Close all tool windows / panels
Window managment
⌃ + wb
Move tab to bottom split ⌃ + wm
Move tab to opposite split ⌃ + wr
Move tab to right split
Multiple cursors
⌘⌥⌃ + a
Add cursors to all whole occurrences ⌘⌥⌃ + b
Add cursors to all occurrences ⌘⌥⌃ + e
Add cursors to ends of selected lines ⌘⌥⌃ + f
Add cursor to next whole occurrence ⌘⌥⌃ + g
Add cursor to next occurrence ⌘⌥⌃ + p
Add cursor to previous whole occurrence ⌘⌥⌃ + x
Remove occurrence