How do I see a summary of all previous quickfix lists from my current session and navigate between them?
Every time you run :grep, :vimgrep, :make, or :cexpr, Vim creates a new quickfix list and pushes the previous one onto a history stack.
category:
buffers-windows
tags:
#buffers-windows
#quickfix
#navigation
#ex-commands
How do I run a macro on every line in a specific line number range?
The :normal command lets you execute Normal mode keystrokes over a range of lines.
category:
macros
tags:
#macros
#normal
#range
#ex-commands
How do I configure Vim's command-line tab completion to show all matches and complete to the longest common prefix?
:set wildmode=list:longest
Vim's wildmode option controls how the command line behaves when you press to complete filenames, buffer names, or Ex commands.
category:
config
tags:
#config
#command-line
#completion
#ex-commands
How do I reference just the extension, stem, or directory of the current file in a Vim command?
Vim exposes the current filename as % in Ex commands, and you can apply modifiers to extract specific parts of the path.
category:
command-line
tags:
#command-line
#ex-commands
#files
#editing
How do I make Vim automatically load a project-specific configuration file from the project directory?
Adding set exrc to your vimrc tells Vim to read a .
category:
config
tags:
#config
#ex-commands
#navigation
How do I turn off diff mode in all windows at once after comparing files?
The :diffoff! command exits diff mode in every window simultaneously.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#editing
How do I get the current search match index and total count programmatically in Vim?
The searchcount() function returns a dictionary containing the current search state: which match the cursor is on, how many total matches exist, and whether the
category:
search
tags:
#search
#ex-commands
#registers
#completion
How do I open a file found in Vim's path setting in a new split without typing the full path?
:sfind (split-find) searches Vim's path setting for a file matching the given name and opens it in a new horizontal split, all in one command.
category:
navigation
tags:
#navigation
#buffers
#windows
#ex-commands
How do I temporarily disable all autocommands when running an Ex command?
The :noautocmd prefix (abbreviated :noa) suppresses all autocommand events for the duration of the following command.
category:
command-line
tags:
#ex-commands
#autocommands
#performance
#command-line
#scripting
How do I set an environment variable inside Vim so it is available to shell commands I run?
Vim lets you read and write environment variables using the $VARIABLE syntax in Vimscript.
category:
config
tags:
#ex-commands
#config
#command-line
How do I delete the line immediately following every line that matches a pattern?
Using :g/pattern/+1d you can delete the line that comes right after each line matching a pattern, in one pass.
category:
command-line
tags:
#ex-commands
#editing
#search
#command-line
How do I use case modifiers like \u and \U in a substitution replacement to change capitalization?
Vim's substitute command supports case-modifier escapes in the replacement string: \u uppercases the next character, \U uppercases all text until \E or end of r
category:
search
tags:
#search
#editing
#substitute
#regex
#ex-commands
How do I quickly create an Ex command range spanning the next N lines using a count before the colon?
Typing a count before : in normal mode automatically fills in a line range in the command line.
category:
command-line
tags:
#command-line
#ex-commands
#ranges
#normal-mode
How do I configure Vim's :grep command to use a faster external search tool like ripgrep or ag?
:set grepprg={cmd} grepformat={fmt}
Vim's :grep command delegates to an external tool defined by grepprg, then parses the output according to grepformat to populate the quickfix list.
category:
search
tags:
#search
#ex-commands
#config
#buffers
How do I control which actions automatically open folds in Vim?
The foldopen option lets you specify exactly which cursor movements and commands will automatically open a closed fold.
category:
config
tags:
#folding
#config
#ex-commands
How do I safely use a filename containing special characters in a Vim Ex command?
When building Vim Ex commands dynamically, filenames with spaces, , %, #, [, or other special characters will be misinterpreted — the space looks like an argu
category:
config
tags:
#ex-commands
#normal-mode
How do I find all files matching a pattern across all directories in Vim's runtimepath?
globpath(&rtp, 'pattern')
globpath() is a Vimscript function that searches all directories in a given path list for files matching a glob pattern.
category:
config
tags:
#ex-commands
#normal-mode
How do I display a colored highlighted message using a highlight group in Vim?
:echohl WarningMsg | echo "message" | echohl None
:echohl sets the highlight group applied to subsequent :echo and :echom output.
category:
config
tags:
#ex-commands
#normal-mode
How do I extract just the parent directory name (not the full path) of the current file in Vim?
Vim's filename modifiers can be chained to transform paths step by step.
category:
command-line
tags:
#ex-commands
#navigation
#command-line
How do I run a normal mode command on multiple lines at once?
The :normal Ex command lets you execute any Normal mode keystrokes on a range of lines simultaneously, turning a single-line operation into a multi-line batch e
category:
editing
tags:
#editing
#normal-mode
#ex-commands
#visual-mode
#text-manipulation