A Ferris Sweep keyboard made me pay attention to the journeys my hands were making. I tried Neovim, explored editors such as Kakoune and Helix, and ended up using Vim movements inside VS Code. That let me keep the project navigation, language tools, and terminal I already relied on while changing how I moved through a line of code.
Start with a journey you make every day
Pick one small trip. Mine might be opening a file, finding a call, reading
its definition, and getting back. On macOS, Cmd +
P opens Quick Open in VS Code. Once in the buffer, a Vim-style
/ search followed by a name and Enter gets me to the text. With
a language service and Vim extension configured, gd can take me
to the definition and Ctrl + o back through the jump
list. Ctrl + i moves forward again.
That return trip is worth learning early. Following a definition feels cheaper when you know how to return to the question you were answering. For a name elsewhere in the project, VS Code’s workspace search is a different trip. On macOS its usual shortcut is Cmd + Shift + F.
Move in the same units you think in
In Normal mode, h, j, k, and
l move left, down, up, and right. They are a starting point. On
a line of identifiers, w moves to the start of the next word,
b goes back to a word start, and e goes to a word
end. When I know the word under the cursor is the one I want elsewhere,
* searches forward for it. On a matching bracket,
% jumps to its partner.
Editing gets interesting when you can name the thing to replace. From inside
send(previousValue), ci( changes the contents of
the parentheses and enters Insert mode. Type nextValue, then
Escape. The parentheses survive. In a similar call, a dot can repeat the
change. Check what the cursor is inside before repeating it.
Use the editor’s Rename Symbol command when a change should follow a declaration and its references. A text operation knows where a word occurs. The language service can know which occurrences refer to the same symbol.
Let context decide what a shortcut does
I use splits to keep a call site and an implementation in view. My
directional pane bindings use Option with h, j,
k, and l. I also use Cmd +
Option + J to cycle terminals. These are choices in my
setup. When making your own bindings, check what owns the keypress while the
terminal has focus. VS Code’s Keyboard Shortcuts editor shows the command
and its when condition together.
Here’s one binding for that setup. Add the object to the array in VS Code’s
keybindings.json. With the editor focused and a second group to
the left, Option-H moves focus to that group.
{
"key": "alt+h",
"command": "workbench.action.focusLeftGroup",
"when": "editorTextFocus"
}
For a longer detour, a named Vim mark is another way back. Set a lowercase
mark such as ma for a location in the current file and return
to its exact position with `a. Uppercase marks can span
files in Vim. Try that behaviour in your extension before making it part of
your routine.
Rehearse the whole edit
Choose a task short enough to repeat twice: open a file, find a call, change its argument, and return to where you started. Learn the command for whichever step interrupts your train of thought. Tomorrow, try it in a real change. That is a better test of a shortcut than remembering its name from a list.