How do I scroll the screen to position the cursor line at the center, top, or bottom?
Vim's z scroll commands reposition the screen relative to the cursor without moving the cursor itself.
category:
navigation
tags:
#navigation
#scrolling
#viewport
#cursor-position
How do I navigate by sentences, paragraphs, and sections in Vim?
Vim provides structural navigation motions that move by sentences, paragraphs, and sections.
category:
navigation
tags:
#navigation
#motions
#sentence
#paragraph
How do I navigate back through the tag stack after jumping to definitions?
When you jump to a tag definition with , Vim pushes your location onto a tag stack.
category:
navigation
tags:
#navigation
#tags
#tag-stack
#code-navigation
What is the difference between word and WORD motions in Vim?
Vim distinguishes between "words" (sequences of keyword characters) and "WORDS" (sequences of non-blank characters).
category:
navigation
tags:
#navigation
#motions
#word
#word-motion
How do I navigate through wrapped lines visually instead of by actual lines?
When wrap is enabled, long lines wrap across multiple screen lines.
category:
navigation
tags:
#navigation
#motions
#wrapped-lines
#display
How do I use count prefixes to amplify motions and operators in Vim?
Almost every Vim motion and operator accepts a numeric count prefix that repeats or amplifies the action.
category:
navigation
tags:
#navigation
#motions
#count
#operators
What is the difference between 0 and ^ for moving to the beginning of a line?
Vim has two distinct motions for moving to the start of a line: 0 goes to column 1 (the absolute start), while ^ goes to the first non-blank character.
category:
navigation
tags:
#navigation
#motions
#line-navigation
#indentation
What is the difference between backtick and apostrophe when jumping to marks?
Vim has two ways to jump to marks: backtick (` `) jumps to the exact line AND column, while apostrophe (') jumps to the line only, positioning the cursor at the
category:
navigation
tags:
#navigation
#marks
#positioning
#motions
How do I jump between method or function definitions in Vim?
The [m and ]m motions jump to the start of method/function definitions in languages with brace-delimited blocks.
category:
navigation
tags:
#navigation
#motions
#methods
#code-navigation
How do I combine the dot command with macros for powerful repeat workflows?
The dot command (.
category:
macros
tags:
#macros
#dot-command
#repeat
#workflow
How do I save and restore macros across Vim sessions?
Vim can persist register contents (including macros) across sessions using viminfo (Vim) or shada (Neovim).
category:
macros
tags:
#macros
#persistence
#viminfo
#sessions
How do I create a recursive macro that runs until it encounters an error?
A recursive macro calls itself at the end of its recording, causing it to repeat until a motion or search fails.
category:
macros
tags:
#macros
#recursive
#automation
#repeat
How do I use cgn to repeat a change on every search match?
/pattern<CR>cgnreplacement<Esc>.
The gn text object selects the next search match, and cgn changes it.
category:
macros
tags:
#macros
#cgn
#search
#interactive-replace
How do I repeat or reverse inline character search with f, t, ; and , in Vim?
The f, F, t, and T motions search for a character on the current line.
category:
navigation
tags:
#navigation
#motions
#find
#inline-search
How do I search across files using the location list instead of quickfix?
While :vimgrep populates the global quickfix list, :lvimgrep uses the window-local location list instead.
category:
search
tags:
#search
#location-list
#vimgrep
#files
How do I create a macro that only acts on lines matching a search pattern?
By starting a macro with a search command, the macro becomes conditional — it jumps to the next match before acting, and terminates when no more matches are f
category:
macros
tags:
#macros
#search
#conditional
#pattern
How do I convert a recorded macro into a permanent mapping?
:nnoremap <leader>x :norm! @a<CR>
Once you've perfected a macro by recording and testing it, you can make it permanent by converting it into a mapping in your vimrc.
category:
macros
tags:
#macros
#mapping
#vimrc
#permanent
How do I debug a macro by stepping through it command by command?
:let g:debug_macro=1 | normal @a
When a macro doesn't work as expected, debugging it step by step is essential.
category:
macros
tags:
#macros
#debugging
#troubleshooting
#registers
How do I move a line or selection up or down in Vim?
The :move command relocates lines to a specific position without using delete and paste.
category:
editing
tags:
#editing
#move
#lines
#rearrange
How do I append a semicolon to every line in a file using :norm?
The :%norm command runs normal mode commands on every line in the file (or a range).
category:
editing
tags:
#editing
#normal-command
#range
#batch-edit