How do I yank or delete a line range directly into a named register without selecting it visually?
Vim's :[range]yank and :[range]delete Ex commands let you capture arbitrary line ranges into a register from the command line, bypassing the need to move the cu
category:
registers
tags:
#registers
#ex-commands
#editing
#normal-mode
How do I make the indent width automatically match the tabstop setting without keeping them in sync manually?
Setting shiftwidth=0 tells Vim to use the value of tabstop wherever shiftwidth would normally be consulted — for the > and and in insert mode, and auto-indent
category:
config
tags:
#indentation
#config
#editing
#ex-commands
How do I travel backward through undo history by time rather than by change count?
Vim's :earlier and :later commands let you travel through undo history using real-world time intervals instead of individual change counts.
category:
editing
tags:
#undo-redo
#ex-commands
#editing
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 convert a file from Windows CRLF to Unix LF line endings in Vim?
When you open a Windows file in Vim on a Unix system, you may see ^M at the end of every line — that's the carriage return (\r) from CRLF line endings.
category:
editing
tags:
#editing
#config
#ex-commands
How do I navigate between multiple quickfix lists from previous searches or builds?
Vim maintains a history stack of up to 10 quickfix lists.
category:
buffers-windows
tags:
#buffers-windows
#navigation
#ex-commands
#search
How do I make the = operator use an external formatter instead of Vim's built-in indentation?
The equalprg option replaces Vim's built-in = indentation operator with any external formatting program.
category:
config
tags:
#config
#indentation
#formatting
#ex-commands
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 reuse the last visual selection range in an Ex command after exiting visual mode in Vim?
Vim automatically sets two special marks whenever you make a visual selection: ' (end).
category:
visual-mode
tags:
#visual-mode
#marks
#ex-commands
#navigation
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 write a file in Vim without triggering BufWritePre or other write autocmds?
The :noautocmd modifier runs any Ex command while suppressing all autocmd events for its duration.
category:
config
tags:
#config
#ex-commands
#editing
#normal-mode
How do I center or right-align text within a specific column width in Vim?
Vim has three built-in Ex commands for aligning text without any plugins: :left, :center, and :right.
category:
editing
tags:
#editing
#formatting
#ex-commands
#visual-mode
How do I open any file in a project by partial name without a fuzzy finder plugin in Vim?
Vim's built-in :find command supports recursive glob patterns, making it possible to locate and open files anywhere in a project without installing a fuzzy find
category:
navigation
tags:
#navigation
#ex-commands
#buffers
#completion
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 integrate a custom build tool or test runner with Vim's :make command and quickfix list?
Vim's :make command runs a build program and automatically loads its output into the quickfix list so you can jump directly to errors and warnings.
category:
config
tags:
#ex-commands
#command-line
#buffers-windows
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
How do I change the working directory to the folder containing the current file without affecting other windows?
:lcd %:p:h sets the working directory for the current window to the directory of the file you're editing, using Vim's path expansion modifiers.
category:
buffers-windows
tags:
#buffers-windows
#ex-commands
#navigation
How do I inspect all syntax highlight groups stacked under the cursor to debug colorscheme or syntax issues?
:echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
When syntax highlighting looks wrong or a colorscheme override isn't taking effect, you need to know exactly which highlight groups are active under the cursor.
category:
config
tags:
#config
#ex-commands
#normal-mode
How do I change the case of matched text in a substitute replacement using \u, \U, \l, or \L modifiers?
Vim's substitute command supports case-change modifiers in the replacement string that let you capitalize, uppercase, or lowercase matched text as part of the s
category:
search
tags:
#search
#ex-commands
#substitute
#editing