How do I let h/l and arrow keys wrap to adjacent lines at line boundaries?
:set whichwrap+=<,>,h,l
By default, h and l stop at line boundaries.
:set whichwrap+=<,>,h,l
By default, h and l stop at line boundaries.
5g;
Most users know g; moves backward through the changelist, but fewer people use a count with it.
:set jumpoptions+=stack
By default, Vim's jumplist can feel surprising: if you jump backward and then make a new jump, the old forward path is not always discarded like a browser histo
/pattern/e+1<CR>
Most Vim searches place the cursor at the start of the match.
]m / [m
When you're reviewing or refactoring C-style code, jumping by words or paragraphs is too coarse, and search can become noisy.
navigation #navigation #motions #code-navigation #normal-mode
gN
Most users know gn for selecting the next search match, but its counterpart gN is the real power move when you need to work backward through matches.
visual-mode #visual-mode #search #motions #editing #normal-mode
f{vi{U
When editing structured text, you often need to transform content inside delimiters without touching the delimiters themselves.
*NgUgn
gn is often treated as a visual selection command, but it is more powerful when used as a motion target for operators.
qagUiwWq2@a
Macros are most powerful when they encode both the edit and the movement to the next target.
mzgUiw`z
When you run an operator like gUiw, Vim can leave your cursor in a slightly different place than where you started.
d/END/e<CR>
When you need to remove text up to a known marker, a plain search motion is often almost right but stops at the start of the match.
5<C-o>
Most Vim users know jumps backward in the jumplist, but fewer use a count with it.
g;zvzz
Jumping through the changelist with g; is useful, but in real files the destination can land inside a closed fold or off-center on screen, which slows review.
,
After using f, t, F, or T for single-character motion on a line, Vim lets you repeat that character search without retyping the target.
]`
Most users jump to marks directly ('a, ` a `), but when a file has many lowercase marks, stepping through them in order is faster than remembering each name.
:s/\%#\k\+/REPL/
Most substitutions operate on broad ranges, but sometimes you want a precise edit anchored to where your cursor is right now.
''
When you jump around a file, Vim tracks prior locations.
navigation #navigation #motions #marks #jumplist #normal-mode
:packadd matchit<CR>
The default % motion is great for simple delimiters, but many code structures use semantic pairs like if/else/endif, try/catch, or HTML tags.
{count}n
Like most Vim motions, the n and N search repeat commands accept a count prefix.
dv{motion}
In operator-pending mode — after typing an operator like d, y, or c but before the motion — you can press v, V, or to override the motion type to characterw