How do I manually add the current position to the jump list before making a large movement?
m'
Vim's jump list automatically records your position whenever you make large motions (like G, /pattern, or ).
m'
Vim's jump list automatically records your position whenever you make large motions (like G, /pattern, or ).
z. / z-
Vim has scroll-positioning commands that come in two flavors: those that leave the cursor in the current column (zz, zt, zb) and those that also move the cursor
:tjump {name}
Vim's :tjump is the smarter sibling of :tag and :tselect.
+ and -
The + and - motions jump to the first non-blank character of the next or previous line respectively — combining vertical movement and ^ into a single, count-a
[<C-d>
Vim's [ command jumps to the first definition of the macro or identifier under the cursor, searching from the beginning of the current file and through any file
]# and [#
Vim provides the ]# and [# motions specifically for navigating C preprocessor conditionals.
{count}H and {count}L
Most Vim users know H jumps to the first visible line, M to the middle, and L to the last.
]n
During a git merge, Vim can navigate directly between conflict markers (>>>>>>) using ]n and [n.
:sfind {file}
:sfind (split-find) searches Vim's path setting for a file matching the given name and opens it in a new horizontal split, all in one command.
50%
Prefixing the % command with a count jumps the cursor to that percentage through the file.
8g8
The 8g8 command searches forward from the cursor for the first byte that belongs to an invalid UTF-8 sequence.
:keepjumps {command}
The :keepjumps modifier lets you run any movement or command without recording a new entry in the jump list.
navigation #navigation #ex-commands #jump-list #normal-mode #vimscript
z.
Vim has two flavors of each screen-repositioning command: one that only moves the view and one that also repositions the cursor.
zH and zL
zH and zL scroll the viewport horizontally by half a screen width, letting you navigate wide content efficiently when wrap is disabled.
navigation #navigation #scrolling #horizontal #nowrap #motions
z<CR> and zt
Both zt and z scroll the view so that the current line lands at the top of the screen, but they differ in one small but important way: z also moves the cursor t
nzz
Typing nzz chains two normal-mode commands: n jumps to the next match of the last search, and zz immediately redraws the screen so the cursor line is vertically
[/
When editing code, you often need to navigate to the boundaries of multi-line block comments (/ .
m<
Vim's ' marks record the start and end of the last visual selection and power the ' range used by Ex commands.
z<CR>
While zt scrolls the current line to the top of the screen, z does the same scroll but also moves the cursor to the first non-blank character of that line.
zj
When your file uses folds, zj and zk let you navigate directly to fold boundaries — jumping to the start of the next fold below or the end of the previous fol