How do I right-align a block of text to a specific column width using an Ex command?
Vim has built-in Ex commands for text alignment — :right, :left, and :center — that work over any line range without plugins.
category:
command-line
tags:
#formatting
#indentation
#command-line
#ex-commands
How do I sort lines numerically so that 10 sorts after 2 rather than before it?
By default, :sort in Vim uses lexicographic (alphabetical) ordering, so "10" sorts before "2" because "1" sort n — sort selected lines by the leading number,
category:
visual-mode
tags:
#visual-mode
#ex-commands
#editing
How do I undo all changes made since the last time I saved the file in a single step?
The :earlier {count}f command navigates Vim's undo tree to the state of the buffer at the time of the last (or Nth) file write.
category:
editing
tags:
#undo-redo
#ex-commands
#editing
How do I jump to a specific byte offset position in a file?
The go command moves the cursor to a specific byte offset from the start of the buffer.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I jump to the start or end of the last changed, yanked, or pasted text using automatic marks?
Vim automatically sets two special marks after every change, yank, or put operation: '[ and '].
category:
navigation
tags:
#marks
#navigation
#editing
#normal-mode
How do I use look-behind assertions in Vim regex to match text only when preceded by a pattern?
The \@<= operator is Vim's zero-width look-behind assertion.
category:
search
tags:
#search
#regex
#patterns
#normal-mode
How do I delete a fold definition at the cursor without deleting the underlying text?
zd removes the fold definition at the cursor position — the text inside the fold is not deleted.
category:
editing
tags:
#folding
#editing
#normal-mode
How do I anchor a Vim search pattern to match only at the very start or end of the entire file?
Vim's ^ and $ anchors match the start and end of a line, but sometimes you need to match the very beginning or very end of the entire buffer.
category:
search
tags:
#search
#regex
#ex-commands
How do I diagnose plugin and system issues from within Neovim using the built-in health checker?
Neovim ships with a built-in health framework that runs diagnostic checks for core components and installed plugins.
category:
plugins
tags:
#config
#editing
#ex-commands
How do I make Vim spell check CamelCase and mixedCase identifiers as individual words?
By default, Vim treats camelCase as a single word and flags it as a spelling error even when both camel and case are correctly spelled.
category:
config
tags:
#config
#spell
#editing
How do I selectively accept LOCAL or REMOTE changes in a three-way git merge using Vim?
When Vim is configured as a git mergetool, it opens a three-way split with the LOCAL (your branch), REMOTE (their branch), and MERGED (the output file) buffers.
category:
buffers-windows
tags:
#buffers-windows
#diff
#editing
#command-line
How do I mark and delete multiple files at once from within Vim's built-in file explorer netrw?
Vim's built-in file browser netrw (opened with :Explore or :Ex) supports a full file management workflow beyond simple navigation.
category:
plugins
tags:
#navigation
#buffers
#ex-commands
How do I detect whether a macro is currently being recorded or executed in Vimscript?
reg_recording() and reg_executing()
Vim exposes two built-in functions for querying the current macro state: regrecording() and regexecuting().
category:
macros
tags:
#macros
#registers
#normal-mode
How do I prevent autocommands from being registered multiple times when re-sourcing my vimrc?
augroup MyGroup | autocmd! | augroup END
Every time you run :source $MYVIMRC or :source % to reload your config, any bare autocmd calls are appended to Vim's autocommand table — no checking for dupli
category:
config
tags:
#config
#ex-commands
#autocmd
How do I run a command on every entry in the location list, like a window-local quickfix?
Vim maintains two parallel systems for collections of file positions: the quickfix list (global, one per Vim session) and the location list (local to each windo
category:
command-line
tags:
#command-line
#ex-commands
#buffers
#search
How do I delete all lines matching my last search pattern without retyping it?
:g//d uses an empty pattern in the global command, which instructs Vim to reuse the last search pattern.
category:
search
tags:
#search
#ex-commands
#global-command
#editing
How do I make Vim's command-line tab completion case-insensitive for file and buffer names?
:set wildignorecase makes Vim's command-line tab completion treat uppercase and lowercase letters as equivalent when completing file names, buffer names, and ot
category:
command-line
tags:
#command-line
#completion
#config
#ex-commands
How do I make Vim remove the comment leader from the second line when joining two comment lines?
Adding the j flag to formatoptions causes Vim to strip the comment leader from the second line when two comment lines are joined with J.
category:
config
tags:
#editing
#formatting
#config
#ex-commands
How do I open all nested folds under the cursor at once in Vim?
zO (uppercase O) opens the fold under the cursor and all folds nested inside it recursively.
category:
editing
tags:
#folding
#editing
#normal-mode
How do I jump to the start or end of the current fold in Vim?
The [z and ]z commands jump the cursor to the start and end of the innermost open fold containing the cursor.
category:
navigation
tags:
#navigation
#folding
#motions