How do I search for a pattern only within specific columns of a line?
When working with columnar data like CSV files, log files, or fixed-width records, you often need to match a pattern only when it appears in a specific column r
category:
search
tags:
#search
#regex
#navigation
#ex-commands
How do I run commands without disturbing my marks?
Many Ex commands silently adjust or delete marks as a side effect of modifying buffer content.
category:
editing
tags:
#editing
#marks
#ex-commands
#scripting
How do I run a command on every individual quickfix entry in Vim?
:cdo {cmd} executes a command at every entry in the quickfix list, visiting each location in turn.
category:
command-line
tags:
#command-line
#ex-commands
#search
#editing
How do I restore a file to its state at a specific time?
The :earlier command restores the buffer to its state at a specific time in the past.
category:
editing
tags:
#editing
#undo-redo
#ex-commands
How do I perform a substitute only within a visual block column?
:'<,'>s/\%Vpattern/replacement/g
Using \%V in a substitute pattern restricts matching to within the visual block area only, rather than the full lines.
category:
visual-mode
tags:
#visual-mode
#search
#ex-commands
How do I search across multiple files and navigate results without leaving Vim?
:vimgrep /pattern/g **/*.ext
The :vimgrep command searches for a pattern across multiple files and loads the results into the quickfix list.
category:
search
tags:
#search
#multi-file
#quickfix
#grep
#workflow
How do I get improved % matching for language keywords like if/else/endif in Vim?
The vim-matchup plugin by Andy Massimino is a drop-in replacement for Vim's built-in matchit plugin that supercharges the % key to work with language-specific k
category:
plugins
tags:
#plugins
#matchup
#navigation
#text-objects
#matching
How do I append text to the end of multiple lines that have different lengths?
Visual block mode normally selects a fixed-width column, which makes appending tricky when lines have different lengths.
category:
visual-mode
tags:
#visual-mode
#editing
#insert-mode
How do you use vim-fugitive for Git operations?
vim-fugitive provides Git integration.
category:
plugins
tags:
#plugins
#fugitive
#git
How do you use a function in the replacement of a substitution?
:%s/\d\+/\=submatch(0)*2/g
Use \= to evaluate expressions.
category:
search
tags:
#search
#substitute
#function
How do I delete all lines that do NOT match a pattern?
The :v command (short for :vglobal) is the inverse of :g — it executes a command on every line that does not match the given pattern.
category:
command-line
tags:
#editing
#ex-commands
#search
#filtering
#productivity
How do I run a substitution only within the exact columns of a visual selection, not the whole line?
:'<,'>s/\%Vpattern/replacement/g
When you press : after making a visual selection, Vim inserts ' to restrict the substitution to the selected lines.
category:
visual-mode
tags:
#visual-mode
#search
#editing
#ex-commands
#normal-mode
How do I use Git from within Vim with vim-fugitive?
:Git command (e.g., :Git status)
vim-fugitive by Tim Pope is a comprehensive Git wrapper for Vim.
category:
plugins
tags:
#plugins
#ex-commands
How do I run Normal mode commands in a script without triggering my custom mappings?
:normal {keys} executes keystrokes as if typed in Normal mode — but it respects your custom mappings and abbreviations.
category:
macros
tags:
#macros
#ex-commands
#normal-mode
How do I send Telescope results to the quickfix list for bulk editing?
While inside any Telescope picker, pressing sends all current results to the quickfix list and closes the picker.
category:
plugins
tags:
#plugins
#search
#quickfix
#buffers-windows
How do I split a complex Vim macro into reusable subroutines?
Record worker macro in @b, call it from @a with @b
Complex macros are hard to debug and maintain when crammed into a single register.
category:
macros
tags:
#macros
#registers
#editing
How do I jump back and forth between my two most recent cursor positions?
Vim maintains a jumplist — a history of every "jump" you make (searches, marks, gg, G, %, etc.
category:
navigation
tags:
#navigation
#jumplist
#motions
#workflow
How do I apply a normal mode command to every line in a range at once?
:normal (abbreviated :norm) executes a sequence of normal-mode keystrokes on each line of an address range.
category:
command-line
tags:
#ex-commands
#editing
#normal-mode
#macros
How do you use a macro to convert CSV data to a Markdown table row?
qaI| <Esc>:s/,/ | /g\nA |<Esc>jq
Record a macro that adds pipe delimiters around CSV fields, converting each line to a Markdown table row format.
category:
macros
tags:
#macros
#table
#markdown
How do you use a register value in a substitute command?
In command-line mode, a inserts the contents of register a.
category:
registers
tags:
#registers
#substitute
#search