How do I search through command history and only see commands that start with what I've already typed?
In Vim's command line, and navigate history in prefix-filtered mode — they only cycle through past commands that begin with whatever you have already typed.
category:
command-line
tags:
#command-line
#history
#navigation
How do I run a command on lines matching a pattern within blocks matching another pattern?
The :global command accepts a range, which lets you scope its search to sections of the file rather than the entire buffer.
category:
command-line
tags:
#ex-commands
#search
#editing
#normal-mode
How do I list all possible completions for the current command-line entry in Vim?
Pressing in Vim's command line displays the full list of matching completions below the command prompt, without cycling through them one at a time.
category:
command-line
tags:
#command-line
#completion
#ex-commands
#navigation
How do I undo or redo all changes made within a specific time window in Vim?
:earlier {N}m and :later {N}m
Vim's :earlier and :later commands let you travel through your edit history by wall-clock time rather than by individual undo steps.
category:
command-line
tags:
#undo-redo
#ex-commands
#editing
How do I open or edit a file in the same directory as the file I am currently editing?
Vim expands % to the current file's path in Ex commands, and the :h modifier strips the last filename component to give you just the directory.
category:
command-line
tags:
#ex-commands
#buffers
#navigation
#editing
How do I look up which two-character code produces a special character when using Vim's digraph system?
:digraphs (abbreviated :dig) displays a full reference table of every digraph registered in Vim.
category:
command-line
tags:
#editing
#special-characters
#insert-mode
#command-line
How do I right-align lines of text within a given column width using a built-in Vim command?
Vim's :right command right-aligns text by padding lines with leading spaces up to a given width.
category:
command-line
tags:
#ex-commands
#formatting
#editing
How do I copy a specific line by number to after the current line?
The :t ex command (also spelled :copy) copies a range of lines to a target address without touching any register.
category:
command-line
tags:
#ex-commands
#editing
#command-line
How do I manually re-trigger filetype-based autocmds without reopening the file?
When you change a buffer's filetype mid-session — say with :set filetype=python — Vim updates the filetype option but does not automatically re-run the File
category:
command-line
tags:
#ex-commands
#autocmd
#filetype
#config
How do I center-align a line or range of lines to a specific column width in Vim?
Vim has a built-in :center command that pads lines with leading spaces to visually center them within a given column width.
category:
command-line
tags:
#formatting
#text-alignment
#ex-commands
#editing
How do I run a Lua expression on every line of a buffer in Neovim?
Neovim's :luado command runs a Lua expression on each line of a range, allowing you to transform text using the full power of Lua's string library.
category:
command-line
tags:
#editing
#ex-commands
#macros
#normal-mode
How do I center or left-align lines of text using an Ex command?
Vim provides three Ex commands for aligning text within a specified column width: :[range]left, :[range]center, and :[range]right.
category:
command-line
tags:
#ex-commands
#formatting
#editing
#command-line
How do I duplicate every line matching a pattern, placing a copy directly below each one?
Combining :global with the :t (copy) command and the .
category:
command-line
tags:
#editing
#ex-commands
#search
#command-line
How do I append a range of lines from the current buffer to another file in Vim?
:[range]write >> filename
The >> modifier on :write appends lines to a file instead of overwriting it.
category:
command-line
tags:
#command-line
#ex-commands
#file-handling
#editing
How do I save a file and automatically create missing parent directories in Neovim?
Neovim's :w ++p flag automatically creates any missing intermediate directories when writing a file.
category:
command-line
tags:
#command-line
#neovim
#file-handling
#workflow
How do I switch back to the previous working directory in Vim?
The :cd - command switches Vim's global working directory back to the previous one, just like cd - in the shell.
category:
command-line
tags:
#command-line
#navigation
#workflow
How do I capture Vim command output to a variable or register using the execute() function?
:let @a = execute('messages')
The execute() function (added in Vim 8.
category:
command-line
tags:
#ex-commands
#registers
#macros
#command-line
How do I insert all completion matches at once on the command line instead of cycling through them one by one?
<C-a> (command-line mode)
In command-line mode, inserts all completions for the word before the cursor at once, as a space-separated list.
category:
command-line
tags:
#command-line
#ex-commands
How do I load a pre-built compiler configuration to set makeprg and errorformat together?
The :compiler command loads a compiler plugin from Vim's runtime path, setting both makeprg (the build command) and errorformat (the error parsing pattern) in o
category:
command-line
tags:
#ex-commands
#command-line
How do I center or right-align a block of text using Vim's built-in Ex commands?
Vim provides three built-in Ex commands for text alignment: :center, :right, and :left.
category:
command-line
tags:
#ex-commands
#editing
#formatting
#visual-mode