How do I create a self-repeating macro that runs until there is nothing left to process?
@q (inside macro recording)
A recursive macro calls itself as its last action, causing it to repeat indefinitely until it hits an error (like reaching end of file or failing a search).
category:
macros
tags:
#macros
#registers
#normal-mode
#editing
How do I re-insert the exact same text I typed during my last insert mode session?
Pressing while in insert mode inserts the same text that was typed during the previous insert mode session.
category:
editing
tags:
#insert-mode
#editing
#registers
How do I search for a whole word only, excluding partial matches?
The \ atoms create word boundaries in a search pattern, matching only complete words and not substrings within larger words.
category:
search
tags:
#search
#normal-mode
How do I prevent duplicate autocommands when reloading vimrc?
augroup name | autocmd! | ... | augroup END
Using augroup with autocmd! inside prevents duplicate autocommands from accumulating when you reload your vimrc.
category:
config
tags:
#config
#command-line
#ex-commands
How do I paste the contents of a register as a new line below the cursor regardless of the register type in Vim?
The :put Ex command always inserts a register's content as a new line below the current line, regardless of whether the register holds characterwise, linewise,
category:
editing
tags:
#registers
#editing
#paste
#ex-commands
#normal-mode
How do I replace the contents of the entire current line?
The cc command deletes the entire content of the current line (preserving indentation) and enters insert mode.
category:
editing
tags:
#editing
#normal-mode
How do I jump backward to the previous sentence?
The ( motion moves the cursor backward to the start of the current or previous sentence.
category:
navigation
tags:
#navigation
#motions
#normal-mode
#text-objects
How do I search forward for text in Vim?
The / command initiates a forward search in the file.
category:
search
tags:
#search
#normal-mode
How do I create a mapping that calls a script-local function in Vim without namespace collisions?
(Script ID) is a Vimscript token that expands to a unique, per-script prefix at runtime.
category:
config
tags:
#config
#vimscript
#mappings
#functions
#normal-mode
How do I access the text from my last insert session?
The .
category:
registers
tags:
#registers
#editing
#normal-mode
How do I search and replace text containing special characters?
:%s/\V literal.text/replacement/g
The \V (very nomagic) flag treats all characters as literal except for \.
category:
search
tags:
#search
#ex-commands
How do I match a pattern only if it is NOT followed by something?
The \@! atom is a negative lookahead in Vim regex.
category:
search
tags:
#search
#normal-mode
How do I use the expression register for calculations?
The expression register = evaluates a Vimscript expression and stores the result.
category:
registers
tags:
#registers
#editing
#normal-mode
How do I scroll the view horizontally by half a screen width in Vim?
zH and zL scroll the viewport horizontally by half a screen width, letting you navigate wide content efficiently when wrap is disabled.
category:
navigation
tags:
#navigation
#scrolling
#horizontal
#nowrap
#motions
How do I jump to the next unmatched opening brace?
The [{ command moves backward to the nearest unmatched {.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I select a rectangular block of text in Vim?
The (Ctrl+v) command enters visual block mode, which lets you select a rectangular column of text across multiple lines.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I increment a number under the cursor?
The command increments the number under or after the cursor by 1.
category:
editing
tags:
#editing
#normal-mode
How do I join all selected lines into one line?
In visual mode, pressing J joins all selected lines into a single line with spaces between them.
category:
visual-mode
tags:
#visual-mode
#editing
How do I see Git diff markers in the sign column?
vim-gitgutter shows git diff markers in the sign column next to line numbers.
category:
plugins
tags:
#plugins
#navigation
How do I get an enhanced status line with vim-airline?
Plug 'vim-airline/vim-airline'
vim-airline provides a beautiful, feature-rich status line that shows file info, git branch, diagnostics, and more with minimal configuration.
category:
plugins
tags:
#plugins
#config