How do I load a pre-built compiler configuration to set makeprg and errorformat together?
The :compiler command loads a compiler plugin from Vim's runtime path, setting both makeprg (the build command) and errorformat (the error parsing pattern) in o
category:
command-line
tags:
#ex-commands
#command-line
How do I normalize curly quotes to straight quotes in the current buffer?
:%s/[“”]/"/ge<CR>:%s/[‘’]/'/ge<CR>
When text comes from docs, email, or CMS exports, it often contains typographic quotes (“”‘’) that break code snippets, Markdown tooling, or shell comma
category:
editing
tags:
#editing
#substitute
#formatting
#text-cleanup
How do I delete all blocks of text between two patterns throughout a file?
The :g (global) command can operate on ranges, not just single lines.
category:
search
tags:
#search
#editing
#ex-commands
How do I join all lines in a file into one, or use a custom separator when joining?
Using \n in the pattern of :substitute matches the newline character at the end of each line, letting you join lines with any separator you choose — something
category:
editing
tags:
#editing
#ex-commands
#search
#formatting
How do I toggle common Vim options like spell, wrap, and number with single keystrokes using vim-unimpaired?
The vim-unimpaired plugin adds a set of paired bracket mappings, including a powerful family of option toggles.
category:
plugins
tags:
#config
#plugins
#editing
How do I reselect the previous visual area and convert it to linewise selection?
gv is well known for reselecting the previous visual area, but pairing it with V is a practical upgrade when your next action needs linewise semantics.
category:
visual-mode
tags:
#visual-mode
#navigation
#editing
How do I define custom fold boundaries using a Vimscript expression in Vim?
Setting foldmethod=expr tells Vim to call the foldexpr expression for every line to compute its fold level.
category:
config
tags:
#folding
#config
#normal-mode
How do I keep project search results window-local with a location list?
:lvimgrep /TODO/j **/* | lopen
When you are working in split-heavy sessions, global quickfix results can become noisy because every window shares the same list.
category:
search
tags:
#search
#quickfix
#buffers
#windows
#command-line
How do I use a count with text objects to operate on multiple text objects at once?
Text objects in Vim accept a count, letting you operate on a span of multiple adjacent text objects in one command.
category:
editing
tags:
#editing
#text-objects
#normal-mode
How do I use a macro to wrap each word in quotes?
How it works This macro wraps the current word in double quotes and moves to the next word, making it easy to repeat across a line or file.
category:
macros
tags:
#macros
#editing
#normal-mode
#insert-mode
How do I inspect only Ex command history so I can quickly rerun a complex command?
When you work with long substitution pipelines or multi-part Ex commands, digging through all history (:history) adds noise.
category:
command-line
tags:
#command-line
#history
#ex-commands
#workflow
How do I paste the current Git commit hash directly from Vim using the expression register?
"=system('git rev-parse --short HEAD')->trim()<CR>p
If you frequently write commit references in notes, code comments, or release docs, you can avoid shell context switches and paste the hash straight from Vim.
category:
registers
tags:
#registers
#command-line
#editing
#git
How do I add text to the end of every line in a range?
The :normal command executes normal-mode keystrokes on every line in a range.
category:
command-line
tags:
#command-line
#ex-commands
#editing
#normal-mode
#batch-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 run a recorded macro on every quickfix match without touching unrelated lines?
When a refactor target spans many files but only specific matches matter, running a macro globally is risky.
category:
macros
tags:
#macros
#quickfix
#automation
#ex-commands
How do I keep each search match centered and unfolded as I jump with n?
When you are stepping through many matches, plain n often lands with poor context and can hide the match inside a closed fold.
category:
navigation
tags:
#navigation
#search
#folding
#normal-mode
How do I remove the most recent Ex command from command history in Vim?
When you run sensitive or noisy Ex commands, they stay in command history and can be recalled accidentally.
category:
command-line
tags:
#command-line
#history
#ex-commands
#privacy
How do I zero-pad numbers with :substitute using an expression replacement?
:%s/\v(\d+)/\=printf('%04d', submatch(1))/g<CR>
When you need to normalize IDs, ticket numbers, or sequence values, :substitute can do more than plain text replacement.
category:
command-line
tags:
#command-line
#substitute
#regex
#formatting
#ex-commands
How do I turn a visual selection of lines into a numbered list?
:s/^/\=line('.') - line("'<") + 1 . '. '/
When you need to quickly number a set of lines — such as TODO items, steps, or bullet points — you can use a visual selection combined with a substitution e
category:
visual-mode
tags:
#visual-mode
#editing
#ex-commands
#formatting
#substitute
How do I use capture groups in Vim substitutions to rearrange or swap matched text?
Vim's substitute command supports capture groups using \( and \) (or ( and ) in \v very-magic mode).
category:
search
tags:
#search
#editing
#substitution
#regex
#ex-commands