How do I specify line ranges in Ex commands to target specific parts of a file?
Every Ex command in Vim can be preceded by a range that specifies which lines it should operate on.
category:
command-line
tags:
#command-line
#ex-commands
#ranges
#editing
#productivity
How do I land the cursor a few lines above or below a search match?
Vim's search command accepts an offset after the pattern that shifts where the cursor lands relative to the match.
category:
search
tags:
#search
#navigation
#motions
#regex
#advanced
How do I fuzzy search inside file contents across a project in Vim?
The fzf.
category:
plugins
tags:
#plugins
#fzf
#ripgrep
#search
#workflow
#quickfix
How do I enable spell checking in Vim?
The :set spell command activates Vim's built-in spell checker, which highlights misspelled words directly in your buffer.
category:
config
tags:
#config
#ex-commands
#editing
How do I search and replace text across an entire file?
The :%s/old/new/g command replaces all occurrences of old with new across every line in the file.
category:
search
tags:
#search
#substitute
#ex-commands
#editing
How do I run a Vim command in sandbox mode to prevent side effects?
Vim's sandbox mode restricts what a command can do, preventing it from executing shell commands, writing files, or modifying certain settings.
category:
command-line
tags:
#command-line
#security
#sandbox
#safety
How do I filter buffer contents through an external shell command?
The :%!{cmd} command pipes the entire buffer through an external shell command and replaces the buffer contents with the command's output.
category:
command-line
tags:
#editing
#ex-commands
#shell
#filtering
#productivity
How do I run shell commands without leaving Vim?
Vim lets you execute any shell command directly from within the editor using the :! (bang) command.
category:
command-line
tags:
#ex-commands
#editing
#buffers
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 switch between visual mode and select mode in Vim?
Vim has a lesser-known select mode that behaves like selection in typical GUI editors: any typed character replaces the selection.
category:
visual-mode
tags:
#visual-mode
#select-mode
#editing
#normal-mode
How do I use % to jump between angle brackets in HTML or XML files?
By default, the % command jumps between (), {}, and [] pairs.
category:
config
tags:
#navigation
#config
#matchpairs
#editing
#normal-mode
How do I jump between function or section boundaries in Vim?
[[ and ]] navigate between section boundaries — typically the start of the previous or next top-level block.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I use capture groups to rearrange text in a Vim substitute command?
:%s/\(pattern1\)\(pattern2\)/\2\1/g
Vim's substitute command supports capture groups that let you match parts of text, remember them, and rearrange or reuse them in the replacement.
category:
search
tags:
#search
#substitution
#regex
#ex-commands
#editing
How do I jump between misspelled words in Vim?
How it works When spell checking is enabled in Vim with :set spell, misspelled words are highlighted.
category:
navigation
tags:
#navigation
#normal-mode
#motions
How do I set a different working directory for each split window in Vim?
:lcd (local cd) sets the working directory for the current window only, leaving other windows at their previous directory.
category:
buffers-windows
tags:
#buffers-windows
#navigation
#ex-commands
#config
How do I paste the last yanked text while in Insert mode without using the unnamed register?
In Insert mode, {reg} pastes the contents of any register inline at the cursor.
category:
registers
tags:
#registers
#insert-mode
#editing
How do I list all buffers including unlisted ones like help pages and terminal buffers?
:ls (or :buffers) shows Vim's buffer list, but it hides unlisted buffers — help files, directory listings (netrw), terminal buffers, and scratch buffers marke
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
How do I return to normal mode from absolutely any mode in Vim?
While works to leave insert or visual mode, it does not work in every situation — particularly in terminal mode (:terminal), where is consumed by the running
category:
navigation
tags:
#normal-mode
#insert-mode
#visual-mode
How do I convert between tabs and spaces in a visual selection?
The :retab! command converts between tabs and spaces based on your expandtab setting.
category:
visual-mode
tags:
#visual-mode
#indentation
#tabs
#whitespace
How do I move selected lines up or down in visual mode?
:'<,'>move'>+1 or :'<,'>move'<-2
How it works Vim's :move command lets you relocate lines to a different position.
category:
visual-mode
tags:
#visual-mode
#editing
#ex-commands