Lesson 2 of 9 · 24m
Movement at Project Speed
Search, marks, jump lists, windows, and buffer navigation — moving through real code without touching the mouse.
New Vim users optimize editing speed and then lose all the savings wandering around files. Professionals optimize navigation. Most of your day is not typing; it is getting your eyes and cursor to the right place with the least context loss.
Search is a motion
/foo search forward for foo
?foo search backward
n / N next / previous match
* / # search forward/backward for word under cursorSearch is composable. d/foo deletes from the cursor to the next match. y?class yanks backward to the previous class. With incsearch enabled, Neovim shows the target as you type, so you stop guessing.
Set vim.opt.ignorecase = true with vim.opt.smartcase = true: lowercase queries become case-insensitive, while a query containing capitals becomes case-sensitive. /Foo finds exactly Foo; /foo finds any capitalization.
The jump list is your undo history for attention
Every large movement — search, %, gg, marks — enters the jump list.
Ctrl-o jump backward
Ctrl-i jump forwardThis is the most important pair in Vim navigation. Follow a function call into a definition, read it, then Ctrl-o back to the call site. Do not climb back by scrolling; scrolling destroys your exact position.
Marks are named places
ma set local mark a in this buffer
'a jump to line of mark a
`a jump to exact cursor position of mark a
mA set global mark A across filesUse lowercase marks as temporary bookmarks inside one file and uppercase marks for “the file I keep coming back to.” The exact-position backtick form is usually what you want; the apostrophe form lands at the first nonblank character of the line.
Buffers, files, windows
A buffer is a loaded file; a window is a view onto a buffer; a tab page is a layout of windows. They are not interchangeable.
:ls list buffers
:buffer src/main.ts open a buffer by name fragment
Ctrl-^ alternate file
gf go to file under cursor
Ctrl-w s / Ctrl-w v horizontal / vertical split
Ctrl-w h/j/k/l move between windowsCtrl-^ is the everyday winner: implementation and test, header and source, controller and template. If you use tabs as “one tab per file,” you are fighting the model; buffers are the file list.
Field notes
:jumpsshows the jump list when you feel lost.:marksdoes the same for marks.gijumps back to the last insert position and enters insert mode — invaluable after checking something mid-edit.{and}move by paragraph, and paragraphs in code are often logical blocks because of blank lines.%is not just parentheses; it works on common paired delimiters and, in many filetypes, language-specific pairs when matchit-style support is enabled.
Was this lesson helpful?