How do I switch between charwise, linewise, and blockwise visual mode without losing my selection?
Once you are in any visual mode, pressing v, V, or switches to charwise, linewise, or blockwise visual mode respectively — without cancelling the current sele
category:
visual-mode
tags:
#visual-mode
#normal-mode
#editing
How do I selectively replace occurrences one at a time, choosing to apply or skip each match?
The n.
category:
search
tags:
#search
#editing
#normal-mode
#dot-repeat
#motions
How do I copy one character at a time from the line above or below while typing in insert mode?
<C-e> / <C-y> (insert mode)
In insert mode, copies the character directly below the cursor (from the next line) and copies the character directly above (from the previous line).
category:
editing
tags:
#editing
#insert-mode
#completion
How do I pipe the entire buffer through an external shell command like sort, jq, or a formatter?
:%!{command} replaces the entire buffer contents with the output of piping them through a shell command.
category:
editing
tags:
#editing
#ex-commands
#filtering
#normal-mode
How do I programmatically load text or a macro into a named register from the command line?
:let @{register}=".
category:
registers
tags:
#registers
#macros
#command-line
#vimscript
How do I create a macro that repeats itself automatically until there is nothing left to process?
A recursive macro calls itself at the end of its own definition, causing it to run repeatedly until Vim hits an error — such as reaching the end of the file o
category:
macros
tags:
#macros
#registers
#editing
#normal-mode
How do I make Vim sort buffer completions by most recently used?
With wildmode=lastused, :b cycles buffers in most-recently-used order instead of alphabetically.
category:
config
tags:
#buffers
#completion
#wildmenu
How do I make a mapping that opens a Tab completion menu for buffer switching?
set wildcharm= then nnoremap b :b
wildcharm sets the key that triggers wildmenu expansion inside mappings.
category:
config
tags:
#buffers
#wildmenu
#mappings
#completion
How do I open a fuzzy buffer picker in Neovim with Telescope?
:Telescope buffers opens a fuzzy-searchable list of all open buffers.
category:
plugins
tags:
#telescope
#buffers
#fuzzy-find
#neovim
How do I edit a file without overwriting the alternate buffer?
Every time you open a file with :edit, Vim updates the alternate file register (#) to the previous buffer.
category:
buffers-windows
tags:
#buffers
#ex-commands
#registers
#navigation
How do I pipe a visual selection through an external shell command and replace it with the output?
After making a visual selection and entering the command line with :, Vim automatically inserts the range ' for the selection.
category:
visual-mode
tags:
#visual-mode
#ex-commands
#editing
#shell
How do I reformat text to fit the line width without moving the cursor?
The gw operator reformats text just like gq, but leaves the cursor in its original position after reformatting.
category:
editing
tags:
#editing
#formatting
#motions
#text-objects
How do I highlight a pattern without executing a search or moving the cursor?
Assigning a string directly to the search register @/ with :let causes Vim to highlight all matches (if hlsearch is enabled) without performing a search or movi
category:
registers
tags:
#registers
#search
#normal-mode
#ex-commands
How do I jump to the start of the previous method or function in code?
The [m motion jumps backward to the start of the nearest enclosing or preceding method definition.
category:
navigation
tags:
#navigation
#motions
#code
#normal-mode
How do I browse the full commit history of the current file using vim-fugitive?
vim-fugitive's :G log -- % loads the git commit history for the current file into a quickfix-style log buffer.
category:
plugins
tags:
#plugins
#buffers
#navigation
#ex-commands
How do I match a pattern only when it is preceded or followed by another pattern using Vim regex?
Vim's regex engine supports zero-width lookahead and lookbehind assertions using the \@ atom.
category:
search
tags:
#search
#regex
#normal-mode
#ex-commands
How do I run the same Ex command in every open window at once?
:windo {cmd} executes an Ex command in every window in the current tab page, cycling through each one and applying the command before returning focus to the ori
category:
buffers-windows
tags:
#windows
#buffers
#ex-commands
#buffers-windows
How do I insert text at the beginning of multiple lines at once using visual block mode?
Visual block mode's I command lets you type once and have the text inserted at the cursor column across all selected lines simultaneously.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I browse and restore previously deleted text using Vim's numbered registers?
"1p then u. to cycle through delete history
Vim silently maintains a rolling history of your last 9 deletions in numbered registers "1 through "9.
category:
registers
tags:
#registers
#editing
#normal-mode
#undo-redo
How do I use a Vimscript expression to compute the replacement text in a substitution?
Prefixing the replacement field of :s with \= makes Vim evaluate the rest as a Vimscript expression and use the result as the replacement string.
category:
command-line
tags:
#search
#ex-commands
#editing
#command-line