How do I evaluate a Vimscript expression and use the result as my command-line input?
Pressing e on the command line opens a special prompt that lets you type a Vimscript expression.
category:
command-line
tags:
#command-line
#ex-commands
#vimscript
#insert-mode
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 force any window-opening command to create a vertical split instead of horizontal?
The :vertical command modifier forces any window-opening Ex command to create a vertical split instead of the default horizontal split.
category:
buffers-windows
tags:
#windows
#buffers
#command-line
#splits
#ex-commands
How do I toggle the case of all characters in a visual selection?
In visual mode, pressing ~ toggles the case of every character in the selection.
category:
visual-mode
tags:
#visual-mode
#editing
How do I join all soft-wrapped lines in each paragraph into a single line?
The :g/^.
category:
command-line
tags:
#command-line
#editing
#global
#formatting
#paragraphs
How do I make j and k navigate display lines normally but physical lines when given a count?
nnoremap <expr> j v:count == 0 ? 'gj' : 'j'
By default, j and k move by physical lines (newline-delimited), which jumps over the entire visual span of a long wrapped line in a single keystroke.
category:
config
tags:
#navigation
#config
#motions
#normal-mode
How do I configure Vim's command-line tab completion to show a list of matches?
:set wildmode=longest,list
By default, Vim's command-line completion just cycles through matches one at a time.
category:
config
tags:
#config
#ex-commands
#completion
#command-line
How do I send commands from a Vim buffer to an embedded terminal?
:term then <C-w>N for normal mode
Vim 8+ and Neovim have a built-in terminal emulator that runs inside a buffer.
category:
command-line
tags:
#command-line
#terminal
#workflow
#productivity
How do I search for a pattern across multiple files?
:vimgrep /pattern/ **/*.ext
The :vimgrep command searches for a pattern across multiple files and populates the quickfix list with the results.
category:
search
tags:
#search
#ex-commands
How do I center or right-align text to a specific width in Vim?
Vim has built-in text alignment commands that adjust lines relative to a specified width.
category:
editing
tags:
#editing
#alignment
#formatting
#text
How do I open a new line below the cursor and start typing?
The o command opens a new line below the current line and places you in insert mode, ready to type.
category:
editing
tags:
#editing
#insert-mode
#normal-mode
How do I add a visual indicator at the start of soft-wrapped continuation lines to tell them apart from real line starts?
When wrap is enabled, long lines visually wrap to the next screen row.
category:
config
tags:
#config
#display
How do I prevent a split window from being resized by Vim?
When you have a specific window you want to keep at a fixed size — like a terminal, log viewer, or reference file — winfixheight and winfixwidth prevent Vim
category:
buffers-windows
tags:
#buffers-windows
#windows
#resize
#layout
How do I reverse the order of lines in a file or selection?
Vim doesn't have a built-in reverse command, but you can pipe the buffer through tac (reverse of cat) to flip line order.
category:
editing
tags:
#editing
#reverse
#lines
#external-command
How do I swap a word with the contents of a register using visual mode?
The viwp command visually selects the word under the cursor and replaces it with the contents of the unnamed register (your last yank or delete).
category:
visual-mode
tags:
#editing
#visual-mode
#registers
#paste
#productivity
How do I resize a window horizontally?
The > and > increases width by 1 column > increases width by 10 columns maximizes the window width Example With a vertical split, 20> gives the current window 2
category:
buffers-windows
tags:
#windows
#normal-mode
How do I open a new line above the cursor and start typing?
The O (uppercase) command opens a new blank line above the current line and places you in insert mode, ready to type.
category:
editing
tags:
#editing
#insert-mode
#normal-mode
How do I make a macro conditionally execute commands based on line content?
:if condition | execute 'normal cmd' | endif
How it works Vim macros can include Ex commands with conditional logic.
category:
macros
tags:
#macros
#ex-commands
#editing
How do I show documentation for the selected completion item in a popup window?
Adding popup to completeopt makes Vim display extra information — such as function signatures or documentation — for the currently highlighted completion it
category:
config
tags:
#completion
#insert-mode
#config
#editing
How do I jump between diff hunks in a diff view?
In diff mode, ]c jumps to the next change hunk and [c jumps to the previous one.
category:
navigation
tags:
#navigation
#editing
#normal-mode