How do I pipe the entire buffer through an external shell command and replace its contents with the output?
The ! filter command in Vim sends a range of lines to an external program as standard input, then replaces those lines with the program's standard output.
category:
command-line
tags:
#ex-commands
#editing
#command-line
How do I load shell command output into quickfix without running :grep?
:cgetexpr systemlist('rg --vimgrep TODO')
When you already have a shell command that emits file:line:col:message records, :cgetexpr is a fast way to populate quickfix directly.
category:
command-line
tags:
#quickfix
#command-line
#search
#ex-commands
How do I replace only the current match and then stop when doing an interactive substitution in Vim?
l (in :%s///gc confirm prompt)
When running an interactive substitution with the c flag (e.
category:
editing
tags:
#search
#editing
#substitution
#ex-commands
#normal-mode
How do I set up automatic typo correction in Vim using abbreviations?
Vim's abbreviation feature lets you define automatic text replacements that trigger as you type.
category:
command-line
tags:
#insert-mode
#editing
#ex-commands
How do I open just enough folds to see the current line without expanding everything?
zv (view cursor) opens the minimum number of folds needed to make the current line visible — nothing more.
category:
editing
tags:
#folding
#navigation
#editing
How do I scroll the view left and right when lines are wider than the screen?
When nowrap is set and lines extend beyond the screen width, Vim provides dedicated horizontal scroll commands.
category:
navigation
tags:
#navigation
#normal-mode
#buffers-windows
How do I swap two text regions without using a temporary register in Vim?
The vim-exchange plugin by Tom McDonald provides the cx operator to swap two arbitrary text regions.
category:
plugins
tags:
#plugins
#exchange
#editing
#text-objects
#refactoring
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 change the filename associated with the current buffer in Vim without saving to disk?
:file {newname} (short form: :f {newname}) changes the filename Vim associates with the current buffer.
category:
command-line
tags:
#buffers-windows
#command-line
#ex-commands
How do I jump back in the jumplist and automatically reveal and center the destination?
Jumping backward with is fast, but in folded or dense files it can land you in a collapsed section or near the edge of the screen, forcing extra cleanup keystro
category:
navigation
tags:
#navigation
#jumplist
#folding
#normal-mode
How do I make Vim wrap long lines at word boundaries instead of mid-word?
By default, when wrap is enabled, Vim wraps long lines at the window edge — which can split words in the middle.
category:
config
tags:
#config
#formatting
#indentation
How do I jump between changed lines in a Git-tracked file in Vim?
The vim-gitgutter plugin shows Git diff markers in the sign column and provides ]c and [c mappings to jump between changed hunks — groups of added, modified,
category:
plugins
tags:
#plugins
#gitgutter
#git
#navigation
#diff
How do I write an Ex range where the second address is evaluated relative to the first match instead of the cursor?
In Vim's range notation, a semicolon (;) between two addresses makes the second address relative to the line the first address matched, not to the current curso
category:
command-line
tags:
#command-line
#ex-commands
#search
#ranges
How do I re-insert the text from my last insert session and immediately return to normal mode?
Pressing (Ctrl + @, which is the NUL character) in insert mode inserts the same text that was typed during the most recent insert session, then immediately retu
category:
editing
tags:
#insert-mode
#editing
#undo-redo
How do I display the full absolute path of the current file without leaving normal mode?
Pressing prints the current filename, buffer status, and cursor position in the status line.
category:
navigation
tags:
#navigation
#buffers-windows
#normal-mode
How do I search for non-printable or control characters in Vim?
Files sometimes contain hidden control characters that cause subtle bugs.
category:
search
tags:
#search
#special-characters
#hex
#control-characters
How do I visually select an entire sentence in Vim?
The vas command visually selects the current sentence, including surrounding whitespace.
category:
visual-mode
tags:
#visual-mode
#text-objects
#motions
How do I paste or reuse my last search pattern?
Vim stores your last search pattern in the / register.
category:
registers
tags:
#registers
#search
#insert-mode
#command-line
How do I run a search and replace across multiple files?
:cfdo %s/old/new/g | update
The :cfdo %s/old/new/g update command performs a search and replace across every file in the quickfix list and saves each one.
category:
command-line
tags:
#command-line
#ex-commands
#search
#editing
How do I see all search matches highlighted as I type the pattern?
The combination of incsearch and hlsearch gives you live, interactive search highlighting.
category:
search
tags:
#search
#config
#highlighting
#workflow