How do I pipe the entire buffer through an external shell command and replace its contents with the output?
The ! filter command in Vim sends a range of lines to an external program as standard input, then replaces those lines with the program's standard output.
category:
command-line
tags:
#ex-commands
#editing
#command-line
How do I search across all of Vim's help documentation for a keyword or phrase?
:helpgrep searches the full text of every Vim help file for a pattern and loads all matches into the quickfix list.
category:
search
tags:
#search
#ex-commands
#navigation
How do I scroll the view left or right without moving the cursor in Vim?
When a line is longer than the window width and wrap is off, Vim can display only part of it.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I make Vim wrap long lines at word boundaries instead of mid-word?
By default, when wrap is enabled, Vim wraps long lines at the window edge — which can split words in the middle.
category:
config
tags:
#config
#formatting
#indentation
How do I insert the result of a Vim expression onto a new line in the buffer?
The :put command inserts the contents of a register as a new line below the cursor.
category:
registers
tags:
#registers
#ex-commands
#editing
How do I assign a macro to a register directly from the command line without recording it?
You can assign a string directly to any register using :let @{reg} = '.
category:
macros
tags:
#macros
#registers
#ex-commands
How do I compare two files side by side using Vim's built-in diff mode?
:vertical diffsplit {file}
Vim has a built-in diff mode that highlights added, removed, and changed lines between two (or more) buffers.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#navigation
How do I browse files more naturally using vim-vinegar's enhanced netrw integration?
vim-vinegar is a lightweight plugin by Tim Pope that enhances Vim's built-in file browser (netrw) with a simpler, more intuitive workflow.
category:
plugins
tags:
#plugins
#navigation
#buffers-windows
How do I visually select a double-quoted string including the quotes themselves?
Vim's text objects let you select structured regions of text with two-keystroke shortcuts.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
How do I use ALE to automatically lint and fix code in Vim?
ALE (Asynchronous Lint Engine) is a popular Vim plugin that runs linters and formatters asynchronously in the background, showing errors and warnings in the gut
category:
plugins
tags:
#plugins
#linting
#formatting
How do I apply different settings for specific file types in Vim?
autocmd FileType python setlocal expandtab shiftwidth=4
Vim's autocmd FileType lets you apply settings automatically whenever a specific file type is detected.
category:
config
tags:
#config
#ex-commands
#indentation
How do I break a line at the cursor position without entering Insert mode?
You can split a line at the cursor without entering Insert mode by using r.
category:
editing
tags:
#editing
#normal-mode
#formatting
How do I jump to the middle of a line in Vim?
The gM command moves the cursor to the horizontal middle of the current line, regardless of how long the line is.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I run a macro on every line in the entire file?
To apply a macro to every line in the file, use :%normal @q.
category:
macros
tags:
#macros
#ex-commands
#normal-mode
How do I navigate between errors and results in the quickfix list?
The quickfix list is Vim's built-in way to collect a list of positions — typically compiler errors, grep results, or linter warnings — and jump between them
category:
buffers-windows
tags:
#buffers
#ex-commands
#navigation
How do I paste my last Ex command into the command line or a buffer?
Vim stores your last executed Ex command in the read-only : register.
category:
registers
tags:
#registers
#ex-commands
#command-line
How do I reuse the last search pattern without retyping it in Vim?
In Vim, pressing // (two forward slashes) in Normal mode repeats the last search pattern.
category:
search
tags:
#search
#normal-mode
#motions
How do I save a file under a new name in Vim?
The :saveas {filename} command writes the current buffer to a new file and makes that new file the current buffer's file.
category:
command-line
tags:
#ex-commands
#editing
How do I visually select an entire sentence in Vim?
The vas command visually selects the current sentence, including surrounding whitespace.
category:
visual-mode
tags:
#visual-mode
#text-objects
#motions
How do I convert a variable name between snake_case, camelCase, and other styles in Vim?
The vim-abolish plugin (by tpope) provides a cr (coerce) operator that converts the word under the cursor between naming conventions with a single keystroke pai
category:
plugins
tags:
#plugins
#editing
#normal-mode