How do I prepend ascending numbers only to the lines in my visual selection?
:'<,'>s/^/\=line('.')-line("'<")+1 . '. '/
When you need quick numbered steps, logs, or checklist entries, this pattern adds numbers only to the lines you selected, not the whole buffer.
category:
visual-mode
tags:
#visual-mode
#ex-commands
#editing
#formatting
How do I reindent the previous visual selection and keep it selected?
When you are iterating on indentation, repeating selection steps is wasted motion.
category:
visual-mode
tags:
#visual-mode
#indentation
#editing
#formatting
#workflow
How do I uppercase only the characters inside a visual selection with :substitute?
When you need to transform text in-place without touching surrounding content, \%V is one of Vim's most precise tools.
category:
visual-mode
tags:
#visual-mode
#substitution
#search
#editing
How do I inspect a register as a list of lines in Vimscript?
For advanced register debugging and macro tooling, plain getreg('a') is often not enough.
category:
registers
tags:
#registers
#vimscript
#debugging
#automation
How do I combine the dot command with macros for powerful repeat workflows?
The dot command (.
category:
macros
tags:
#macros
#dot-command
#repeat
#workflow
How do I write a Vim regex that matches across multiple lines?
By default, .
category:
search
tags:
#search
#editing
#ex-commands
How do I find trailing whitespace while skipping completely blank lines in Vim?
A plain trailing-whitespace search like /\s\+$ also matches fully blank lines, which is noisy when you only want accidental spaces after real content.
category:
search
tags:
#search
#regex
#whitespace
#cleanup
#patterns
How do I apply an Ex command only to the exact range of my last change or yank?
When you need to run a command on exactly the text you just changed, yanked, or pasted, Vim's automatic marks are faster and safer than reselecting manually.
category:
command-line
tags:
#command-line
#marks
#indentation
#ex-commands
#normal-mode
How do I clear a macro register to start fresh without using Vimscript?
Pressing qqq in normal mode is the quickest way to empty a macro register.
category:
macros
tags:
#macros
#registers
#normal-mode
How do I center-align or right-align lines of text in Vim without an external tool?
Vim's built-in :left, :center, and :right Ex commands align text without plugins or external tools.
category:
editing
tags:
#editing
#ex-commands
#formatting
How do I swap the first two whitespace-separated columns on every line?
:%s/\v(\S+)\s+(\S+)/\2 \1/<CR>
When you need to flip two fields across a whole file, a single substitution is faster and safer than recording a macro.
category:
editing
tags:
#editing
#substitution
#regex
#ex-commands
#formatting
How do I repeat the last change in Vim?
The .
category:
editing
tags:
#editing
#normal-mode
#productivity
#motions
How do I run a substitution across all files in the argument list?
:argdo %s/old/new/g | update
The :argdo command runs an Ex command on every file in the argument list (the files you opened Vim with, or added via :argadd).
category:
command-line
tags:
#ex-commands
#editing
#command-line
How do I change the text inside parentheses?
The ci( command deletes everything inside the nearest pair of parentheses and places you in insert mode, ready to type a replacement.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#insert-mode
How do I find accidentally repeated words like 'the the' in a document?
When writing or editing text, repeated words like "the the" or "is is" are a common typo that spell checkers often miss.
category:
search
tags:
#search
#editing
#ex-commands
#formatting
How do I run a command between two patterns but exclude the end marker line?
:/BEGIN/,/END/-1s/\s\+$//
When you need to clean or refactor block-like regions, Ex ranges can target lines between two search patterns without selecting text manually.
category:
command-line
tags:
#command-line
#ex-commands
#ranges
#search
#editing
How do I toggle whether / and ? searches wrap around the file?
wrapscan controls what happens when a / or ? search reaches the end (or beginning) of the file.
category:
search
tags:
#search
#options
#command-line
#navigation
How do I run a quickfix refactor once per file instead of once per match?
:cfdo %s/\<GetUser\>/FetchUser/ge | update
When quickfix has many matches per file, :cdo can execute your command repeatedly in the same buffer.
category:
command-line
tags:
#command-line
#quickfix
#refactoring
#ex-commands
#search
How do I deeply merge two Lua tables in Neovim config using vim.tbl_deep_extend?
vim.tbl_deep_extend('force', defaults, overrides)
vim.
category:
config
tags:
#neovim
#lua
#config
#tables
How do I move the current split into a new tab and immediately jump back to the previous tab?
When a split temporarily becomes the center of attention, promoting it to its own tab can reduce layout noise.
category:
buffers-windows
tags:
#buffers
#windows
#tabs
#navigation