How do I create a macro that only acts on lines matching a search pattern?
By starting a macro with a search command, the macro becomes conditional — it jumps to the next match before acting, and terminates when no more matches are f
category:
macros
tags:
#macros
#search
#conditional
#pattern
How do I insert shell command output without leaving the command line?
In command-line mode, =system('command') evaluates the shell command and inserts its output into the command line.
category:
command-line
tags:
#command-line
#ex-commands
How do I visualize and navigate Vim's undo tree?
The undotree plugin provides a visual tree representation of Vim's undo history.
category:
plugins
tags:
#plugins
#undo-redo
How do I replace a word under the cursor?
The ciw command deletes the inner word under the cursor and drops you into insert mode so you can type a replacement.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#insert-mode
How do I add more steps to an existing macro without re-recording it from scratch?
When you record a macro into register q with qq.
category:
macros
tags:
#macros
#registers
#recording
#editing
How do I create incrementing number sequences in Vim?
The g command increments numbers across a visual selection so that each subsequent line gets a progressively higher value.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
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 move selected lines down in the file?
The :m command with the visual range moves selected lines.
category:
visual-mode
tags:
#visual-mode
#editing
#ex-commands
How do I replace a visual block selection with digraph or special characters?
Visual block mode combined with the replace command and digraph input lets you replace a column of characters with special Unicode characters.
category:
visual-mode
tags:
#visual-mode
#digraph
#unicode
#block-mode
How do I run commands without disturbing my marks?
Many Ex commands silently adjust or delete marks as a side effect of modifying buffer content.
category:
editing
tags:
#editing
#marks
#ex-commands
#scripting
How do I execute Vimscript code from the current buffer?
:source % or :'<,'>source
The :source command executes Vimscript from a file.
category:
command-line
tags:
#command-line
#vimscript
#workflow
#development
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 convert a variable name between snake_case, camelCase, and other styles in Vim?
The vim-abolish plugin (by tpope) provides a cr (coerce) operator that converts the word under the cursor between naming conventions with a single keystroke pai
category:
plugins
tags:
#plugins
#editing
#normal-mode
How do I open a file and jump directly to a specific line or pattern?
The :edit command accepts a +{cmd} prefix that executes an Ex command immediately after the file is loaded.
category:
command-line
tags:
#buffers
#ex-commands
#navigation
#command-line
How do I access Vim's built-in help system?
Vim has an extensive built-in help system.
category:
command-line
tags:
#command-line
#ex-commands
How do I create shortcuts for long Ex commands I type frequently?
:cabbrev (command-line abbreviation) lets you define short aliases for longer Ex commands.
category:
command-line
tags:
#command-line
#ex-commands
#config
How do I create nested macros where one macro calls another?
How it works Vim macros can call other macros, creating a modular system of reusable building blocks.
category:
macros
tags:
#macros
#normal-mode
#editing
How do I paste a register in insert mode without triggering auto-indent?
When you use a in insert mode to paste register a, Vim inserts the text as if you typed it character by character.
category:
registers
tags:
#registers
#insert-mode
#indentation
#editing
How do I search for multiple alternative patterns at once in Vim?
Vim's search supports alternation with the \ operator, allowing you to find any one of several patterns in a single search.
category:
search
tags:
#search
#regex
#alternation
#patterns
How do I configure Vim's built-in auto-completion?
:set completeopt=menu,menuone,noselect
The completeopt option controls the behavior of the completion popup menu.
category:
config
tags:
#config
#completion
#ex-commands