How do I force any split command to open as a vertical split in Vim?
Vim's :vertical modifier (abbreviated :vert) can be prepended to any Ex command that opens a split window to make it open as a vertical split instead of a horiz
category:
buffers-windows
tags:
#buffers-windows
#windows
#splits
#ex-commands
How do I change the filename associated with the current buffer in Vim without saving to disk?
:file {newname} (short form: :f {newname}) changes the filename Vim associates with the current buffer.
category:
command-line
tags:
#buffers-windows
#command-line
#ex-commands
How do I open a file in read-only mode so I cannot accidentally modify it?
:view opens a file with the readonly option set, preventing accidental writes.
category:
buffers-windows
tags:
#buffers
#ex-commands
#editing
How do I combine two recorded macros into one without re-recording them from scratch?
Macros in Vim are stored as plain text in named registers.
category:
macros
tags:
#macros
#registers
#ex-commands
How do I set up filetype-specific documentation lookup for the K key in Vim?
:autocmd FileType python setlocal keywordprg=pydoc3
The K command looks up the word under the cursor using the program defined by keywordprg (default: man).
category:
config
tags:
#config
#navigation
#ex-commands
How do I run a normal mode command from the ex command line without triggering my custom key mappings?
:normal {command} runs a sequence of Normal mode keystrokes from the command line (or a range of lines with :%normal), but it applies your custom key mappings.
category:
command-line
tags:
#ex-commands
#macros
#normal-mode
#command-line
How do I reorder tab pages in Vim without specifying an absolute position?
:tabmove normally takes an absolute position (:tabmove 0 moves the tab to the far left), but it also accepts relative offsets using + and -.
category:
buffers-windows
tags:
#tabs
#buffers-windows
#ex-commands
How do I collapse multiple consecutive blank lines into a single blank line throughout a file?
The command :g/^$/,/.
category:
command-line
tags:
#editing
#ex-commands
#whitespace
#formatting
How do I redisplay the output from the last Ex command that already scrolled away?
Pressing g or q to dismiss it again Example Tips :messages also shows recent messages (and those accumulate across the session), while g< only shows the last pa
category:
command-line
tags:
#command-line
#ex-commands
#output
How do I configure command-line Tab completion to show a list and complete the longest common match first?
:set wildmode=list:longest,full
Vim's default Tab completion in the command-line cycles through matches one at a time, making it hard to see all available options at once.
category:
command-line
tags:
#command-line
#completion
#config
#ex-commands
How do I right-align a block of text to a specific column width using an Ex command?
Vim has built-in Ex commands for text alignment — :right, :left, and :center — that work over any line range without plugins.
category:
command-line
tags:
#formatting
#indentation
#command-line
#ex-commands
How do I sort lines numerically so that 10 sorts after 2 rather than before it?
By default, :sort in Vim uses lexicographic (alphabetical) ordering, so "10" sorts before "2" because "1" sort n — sort selected lines by the leading number,
category:
visual-mode
tags:
#visual-mode
#ex-commands
#editing
How do I undo all changes made since the last time I saved the file in a single step?
The :earlier {count}f command navigates Vim's undo tree to the state of the buffer at the time of the last (or Nth) file write.
category:
editing
tags:
#undo-redo
#ex-commands
#editing
How do I anchor a Vim search pattern to match only at the very start or end of the entire file?
Vim's ^ and $ anchors match the start and end of a line, but sometimes you need to match the very beginning or very end of the entire buffer.
category:
search
tags:
#search
#regex
#ex-commands
How do I diagnose plugin and system issues from within Neovim using the built-in health checker?
Neovim ships with a built-in health framework that runs diagnostic checks for core components and installed plugins.
category:
plugins
tags:
#config
#editing
#ex-commands
How do I mark and delete multiple files at once from within Vim's built-in file explorer netrw?
Vim's built-in file browser netrw (opened with :Explore or :Ex) supports a full file management workflow beyond simple navigation.
category:
plugins
tags:
#navigation
#buffers
#ex-commands
How do I prevent autocommands from being registered multiple times when re-sourcing my vimrc?
augroup MyGroup | autocmd! | augroup END
Every time you run :source $MYVIMRC or :source % to reload your config, any bare autocmd calls are appended to Vim's autocommand table — no checking for dupli
category:
config
tags:
#config
#ex-commands
#autocmd
How do I run a command on every entry in the location list, like a window-local quickfix?
Vim maintains two parallel systems for collections of file positions: the quickfix list (global, one per Vim session) and the location list (local to each windo
category:
command-line
tags:
#command-line
#ex-commands
#buffers
#search
How do I delete all lines matching my last search pattern without retyping it?
:g//d uses an empty pattern in the global command, which instructs Vim to reuse the last search pattern.
category:
search
tags:
#search
#ex-commands
#global-command
#editing
How do I make Vim's command-line tab completion case-insensitive for file and buffer names?
:set wildignorecase makes Vim's command-line tab completion treat uppercase and lowercase letters as equivalent when completing file names, buffer names, and ot
category:
command-line
tags:
#command-line
#completion
#config
#ex-commands