How do I pass a range of lines through a shell command and replace them?
The :{range}!command syntax pipes the specified lines through an external shell command and replaces them with the output.
category:
command-line
tags:
#command-line
#shell
#filtering
#unix
#ex-commands
How do I access text from small deletes like dw or x?
The small delete register ("-) captures text from delete operations that are less than one line — like dw, x, dt.
category:
registers
tags:
#registers
#delete
#paste
#normal-mode
How do I re-indent a block of code to match the surrounding indentation?
The = operator performs smart indentation based on Vim's filetype-aware indent rules.
category:
editing
tags:
#editing
#indentation
#text-objects
#formatting
How do I resize Vim windows to exact dimensions?
:resize N / :vertical resize N
The :resize and :vertical resize commands set a window to an exact number of lines or columns.
category:
buffers-windows
tags:
#windows
#layout
#resize
#workflow
How do I search for a pattern and land on a specific line offset from the match?
/pattern/+N or /pattern/-N
Vim's search command accepts an offset that places your cursor on a line relative to the match.
category:
navigation
tags:
#navigation
#search
#offset
#motions
How do I restrict a search to only match within a specific line range?
Vim's \%>Nl and \%10l matches only after line 10 \%10l\%10l\%<20lold/new/g Combine with column restrictions for precise region targeting Tips Line numbers in \%
category:
search
tags:
#search
#regex
#range
#line-numbers
What are Vim's read-only special registers and how do I use them?
". / "% / ": / "# registers
Vim has four read-only special registers that automatically contain useful contextual information.
category:
registers
tags:
#registers
#special-registers
#workflow
#productivity
How do I understand which register Vim uses for each operation?
Vim has 10 types of registers, each serving a specific purpose.
category:
registers
tags:
#registers
#reference
#clipboard
#workflow
How do I replace a character or pattern with a newline in a substitute command?
In Vim's substitute command, \r in the replacement string inserts a newline.
category:
editing
tags:
#editing
#substitute
#newline
#text-manipulation
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
How do I manage files and directories as a regular Vim buffer?
oil.nvim: edit directory listing like a buffer
oil.
category:
plugins
tags:
#plugins
#file-management
#neovim
#oil
#workflow
How do I find and open a file by name without knowing its full path?
The :find command searches for a file by name across all directories in your path setting and opens it.
category:
buffers-windows
tags:
#buffers
#file-management
#navigation
#workflow
How do I browse through my previous quickfix lists?
Vim remembers up to 10 previous quickfix lists.
category:
buffers-windows
tags:
#buffers
#quickfix
#navigation
#history
How do I apply a macro across multiple files at once?
:argdo normal @q | update
The :argdo command runs a command in every file in the argument list.
category:
macros
tags:
#macros
#batch-editing
#multi-file
#ex-commands
#workflow
How do I use a counter variable inside a Vim macro?
:let i=1 then use <C-r>=i<CR> in macro
By combining a Vimscript variable with the expression register inside a macro, you can create a counter that increments on each replay.
category:
macros
tags:
#macros
#vimscript
#counter
#expression
#advanced
How do I prevent a macro from stopping when a command fails?
Use :s/pat/rep/e flag or :silent! prefix
By default, Vim macros abort on the first error — a failed search, a substitute with no matches, or a movement that can't be performed.
category:
macros
tags:
#macros
#error-handling
#ex-commands
#batch-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 use the leader key to create my own keyboard shortcuts?
let mapleader = ' ' then nnoremap <leader>key command
The leader key is a configurable prefix for your custom key mappings.
category:
config
tags:
#config
#mappings
#vimrc
#leader
#workflow
How do I search for a pattern only when it's preceded or followed by another pattern?
/\(pattern\)\@<=target or /target\(pattern\)\@=
Vim supports zero-width assertions (lookahead and lookbehind) in its regex engine.
category:
search
tags:
#search
#regex
#lookahead
#lookbehind
#advanced
How do I use LSP for go-to-definition, references, and refactoring in Neovim?
gd / gr / <leader>rn with nvim-lspconfig
The Language Server Protocol (LSP) brings IDE-level intelligence to Neovim — go-to-definition, find references, rename symbol, and more.
category:
plugins
tags:
#plugins
#lsp
#neovim
#code-navigation
#refactoring