How do I convert a visually selected block of text to uppercase or lowercase?
U
In visual mode, pressing U converts all selected characters to uppercase and u converts them to lowercase.
U
In visual mode, pressing U converts all selected characters to uppercase and u converts them to lowercase.
:/start/,/end/s/pattern/replacement/g
You can restrict a substitution to a range defined by two patterns.
O in visual block mode
In visual block mode (), pressing O (uppercase) moves the cursor to the diagonally opposite corner of the rectangular selection.
\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.
:{range}normal {commands}
The :normal command executes normal mode keystrokes from the command line.
command-line #command-line #ex-commands #editing #normal-mode
<C-r><C-w>
When typing a command on the Vim command line, pressing inserts the word currently under the cursor.
"ap, edit, 0"ay$
When a macro has a small mistake, re-recording the entire thing is tedious.
:center
The :center command pads a line with leading spaces so the text is centered within a given width.
~ (in visual mode)
In visual mode, pressing ~ toggles the case of every character in the selection.
:'<,'>m'>+1
The :m command with the visual range moves selected lines.
<C-n> to select (vim-visual-multi)
vim-visual-multi provides VS Code-style multiple cursor support for Vim.
auto-pairs plugin
auto-pairs automatically inserts closing brackets, parentheses, and quotes when you type the opening one.
"+yy
The "+yy command yanks the current line directly to the system clipboard register, making it available for pasting in other applications.
"adiw
The "adiw command deletes the inner word under the cursor and stores it in register a.
qa f,ldt,F(p q
This macro swaps two comma-separated arguments inside parentheses by cutting the second argument and placing it before the first.
qaI<li><Esc>A</li><Esc>jq
This macro wraps each line in tags by inserting the opening tag at the start and appending the closing tag at the end.
qaI"<Esc>A": "",<Esc>jq
This macro transforms a plain word into a JSON key-value pair format, useful for converting lists of field names into JSON structure.
qaciw"<C-r>""<Esc>wq
This macro wraps the current word in double quotes by changing the word, inserting quotes around the original content, and moving to the next word.
qaA;<Esc>jq
This macro appends a semicolon to the current line and moves down, ready to repeat.
qaI// <Esc>jq
This macro adds a // comment prefix to the beginning of the current line and moves down.