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 automatically fill a new file with a boilerplate template when creating it in Vim?
autocmd BufNewFile *.py 0r ~/.vim/templates/python.py
When you create a new file in Vim (e.
category:
config
tags:
#config
#autocmd
#editing
#ex-commands
How do I open a file under the cursor in a new split and jump to its line number in Vim?
F opens the filename under the cursor in a new horizontal split window and jumps to the line number that follows the filename.
category:
buffers-windows
tags:
#navigation
#buffers-windows
#windows
#editing
How do I prevent a split window from being resized when I open new splits?
:set winfixwidth winfixheight
How it works When you open new split windows in Vim, the existing windows automatically resize to make room.
category:
buffers-windows
tags:
#windows
#ex-commands
#navigation
How do I configure Vim to find a tags file by searching up through parent directories automatically?
By default, Vim only looks for a tags file in the current directory.
category:
config
tags:
#config
#tags
#navigation
#ex-commands
How do I apply a recorded macro to a range of lines without re-recording it in Vim?
The :[range]normal @a command runs a recorded macro against every line in a given range.
category:
macros
tags:
#macros
#registers
#ex-commands
#normal-mode
#advanced
How do I delete, change, or yank an entire sentence as a text object in Vim?
Vim defines a sentence as text ending with .
category:
editing
tags:
#editing
#text-objects
#delete
#normal-mode
#motions
How do I search for a pattern only within specific columns of a line?
How it works Vim's search patterns support column position constraints using the \%c family of atoms.
category:
search
tags:
#search
#ex-commands
#normal-mode
How do I scroll through wrapped long lines smoothly without skipping screen rows?
The smoothscroll option makes scroll commands respect screen rows rather than buffer lines when wrap is enabled.
category:
config
tags:
#config
#navigation
#scrolling
#wrap
How do I use Vim as an inline calculator with the expression register?
The expression register ("=) evaluates Vimscript expressions and returns the result.
category:
registers
tags:
#registers
#insert-mode
#expression
#calculator
#vimscript
How do I navigate all undo states including branches that u and Ctrl+r can't reach?
Vim's undo history is a tree, not a linear stack.
category:
navigation
tags:
#undo-redo
#navigation
#normal-mode
How do I write a Vim plugin using the autoload directory structure?
The autoload mechanism in Vim lets you write plugins whose functions are only loaded into memory when they are first called.
category:
plugins
tags:
#plugins
#ex-commands
#editing
How do I apply a macro to every line in a specific range without running it manually each time?
The :[range]normal @q command replays the macro in register q on every line within a given range.
category:
macros
tags:
#macros
#normal-mode
#ex-commands
#ranges
How do I inspect all syntax highlight groups stacked under the cursor to debug colorscheme or syntax issues?
:echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
When syntax highlighting looks wrong or a colorscheme override isn't taking effect, you need to know exactly which highlight groups are active under the cursor.
category:
config
tags:
#config
#ex-commands
#normal-mode
How do I scroll the screen while also jumping to the first non-blank character of the current line?
Vim has two sets of scroll-and-position commands: zt/zz/zb (which reposition the screen but keep the cursor column intact) and z/z.
category:
navigation
tags:
#navigation
#scrolling
#normal-mode
How do I create a custom undo checkpoint while in Insert mode so I can undo in smaller steps?
By default, Vim treats an entire Insert mode session (from entering Insert mode to pressing ) as a single undo unit.
category:
editing
tags:
#editing
#insert-mode
#undo-redo
How do I delete consecutive duplicate lines from a file using a single Ex command?
The :g command with a backreference pattern can detect and delete consecutive duplicate lines in one pass.
category:
command-line
tags:
#ex-commands
#search
#editing
#normal-mode
How do I repeat a macro as many times as possible until it fails?
Prefixing a macro invocation with a large count like 999@q tells Vim to run register q up to 999 times.
category:
macros
tags:
#macros
#normal-mode
How do I select a rectangular block past the end of shorter lines in visual block mode?
By default, Vim's visual block mode () is limited by line length — if some lines are shorter than others, the block selection gets ragged.
category:
visual-mode
tags:
#visual-mode
#editing
#config
#indentation
How do I make a macro that finds and operates on specific patterns?
qq /pattern<CR> {commands} q
By incorporating a search command inside a macro, you can make it jump to the next occurrence of a pattern before performing its edits.
category:
macros
tags:
#macros
#search
#recording
#workflow
#advanced