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 comment out multiple lines at once in Vim without a plugin?
Vim's Visual Block mode lets you prepend characters (like comment markers) to multiple lines simultaneously.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I indent or unindent the current line while staying in Insert mode?
While in Insert mode, you can adjust indentation without switching back to Normal mode.
category:
editing
tags:
#editing
#insert-mode
#indentation
How do I change surrounding quotes or brackets from one type to another with vim-surround?
The vim-surround plugin (by Tim Pope) adds three powerful operators for working with surrounding delimiters — quotes, brackets, parentheses, and HTML tags.
category:
plugins
tags:
#plugins
#text-objects
#editing
How do I edit a recorded macro without re-recording it from scratch?
Macros are stored as plain text in named registers.
category:
macros
tags:
#macros
#registers
#editing
How do I run a command on every line that does NOT match a pattern?
:v (short for :vglobal) is the inverse of :g.
category:
command-line
tags:
#ex-commands
#command-line
#editing
How do I convert a visually selected block of text to uppercase or lowercase?
In visual mode, pressing U converts all selected characters to uppercase and u converts them to lowercase.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I search for a pattern only within a specific range of lines in Vim?
:/start/,/end/s/pattern/replacement/g
You can restrict a substitution to a range defined by two patterns.
category:
search
tags:
#search
#ex-commands
#editing
#substitution
How do I move to the opposite corner of a visual block selection?
In visual block mode (), pressing O (uppercase) moves the cursor to the diagonally opposite corner of the rectangular selection.
category:
visual-mode
tags:
#visual-mode
#editing
#navigation
How do I change the case of matched text in a Vim substitute command?
\u and \l in :s replacement
Vim's substitute command supports special case modifiers in the replacement string that let you change the case of captured text on the fly.
category:
search
tags:
#search
#editing
#ex-commands
How do I insert the word under the cursor into the Vim command line?
When typing a command on the Vim command line, pressing inserts the word currently under the cursor.
category:
registers
tags:
#command-line
#registers
#editing
How do I edit a recorded macro to fix a mistake without re-recording it?
When a macro has a small mistake, re-recording the entire thing is tedious.
category:
macros
tags:
#macros
#registers
#editing
How do I center-align text within a specific width in Vim?
The :center command pads a line with leading spaces so the text is centered within a given width.
category:
editing
tags:
#formatting
#ex-commands
#editing
How do I toggle the case of all characters in a visual selection?
In visual mode, pressing ~ toggles the case of every character in the selection.
category:
visual-mode
tags:
#visual-mode
#editing
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 edit multiple locations simultaneously like multiple cursors?
<C-n> to select (vim-visual-multi)
vim-visual-multi provides VS Code-style multiple cursor support for Vim.
category:
plugins
tags:
#plugins
#editing
How do I automatically close brackets and quotes as I type?
auto-pairs automatically inserts closing brackets, parentheses, and quotes when you type the opening one.
category:
plugins
tags:
#plugins
#insert-mode
#editing
How do I copy the entire current line to the system clipboard?
The "+yy command yanks the current line directly to the system clipboard register, making it available for pasting in other applications.
category:
registers
tags:
#registers
#editing
How do I delete a word and save it to a specific register?
The "adiw command deletes the inner word under the cursor and stores it in register a.
category:
registers
tags:
#registers
#editing
#text-objects
How do I record a macro to swap two function arguments?
This macro swaps two comma-separated arguments inside parentheses by cutting the second argument and placing it before the first.
category:
macros
tags:
#macros
#editing
#motions