How do I toggle the case of a character in Vim?
~
The ~ command toggles the case of the character under the cursor — uppercase becomes lowercase and vice versa — then advances the cursor one position to the
~
The ~ command toggles the case of the character under the cursor — uppercase becomes lowercase and vice versa — then advances the cursor one position to the
:set paste
The :set paste command enables paste mode, which temporarily disables auto-indentation, smart tabs, and other insert-mode features that can mangle text pasted f
u
The u command undoes the last change you made in normal mode.
gUiw
The gUiw command converts the entire word under the cursor to uppercase.
<C-v>jjjI
Visual block mode combined with I lets you insert the same text at the beginning of multiple lines simultaneously.
<C-v>
The (Ctrl+v) command enters visual block mode, which lets you select a rectangular column of text across multiple lines.
:w !sudo tee %
The :w !sudo tee % command lets you save a file that requires root permissions, even if you forgot to open Vim with sudo.
yy
The yy command yanks (copies) the entire current line, including the newline character.
"+y
The "+y command yanks (copies) text into the system clipboard register, making it available to paste in other applications outside of Vim.
vat
The vat command visually selects the nearest enclosing HTML or XML tag and all of its contents, including the opening and closing tags themselves.
visual-mode #visual-mode #text-objects #editing #normal-mode
V
The V (uppercase) command enters visual line mode, which selects the entire current line.
vi{
The vi{ command visually selects everything inside the nearest pair of curly braces {}, without selecting the braces themselves.
visual-mode #visual-mode #text-objects #editing #normal-mode
vip
The vip command visually selects the inner paragraph — all contiguous non-blank lines surrounding the cursor.
visual-mode #visual-mode #text-objects #editing #normal-mode
:set list
The :set list command makes invisible characters visible by displaying them as special symbols.
:'<,'>sort
The :'sort command sorts the currently selected lines in visual mode alphabetically.
:r filename
The :r filename command reads the contents of filename and inserts them into the current buffer below the cursor line.
<C-r>
The (Ctrl+r) command redoes the last change that was undone with u.
gqip
The gqip command reformats the current paragraph to fit within the configured textwidth.
r{char}
The r{char} command replaces the character under the cursor with {char} without ever entering insert mode.
10@a
The 10@a command replays the macro recorded in register a exactly 10 times.