How do I swap two characters in Vim?
xp
The xp command swaps the character under the cursor with the character to its right.
xp
The xp command swaps the character under the cursor with the character to its right.
~
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
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.
yy
The yy command yanks (copies) the entire current line, including the newline character.
<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.
O
The O (uppercase) command opens a new blank line above the current line and places you in insert mode, ready to type.
o
The o command opens a new line below the current line and places you in insert mode, ready to type.
P
The P (uppercase) command pastes the contents of the default register before the cursor position.
p
The p command pastes (puts) the contents of the default register after the cursor.
>>
The >> command shifts the current line one shiftwidth to the right, adding indentation.
I
The I (uppercase) command moves the cursor to the first non-blank character of the current line and enters insert mode.
J
The J command joins the current line with the line below it, replacing the newline with a space.
guiw
The guiw command converts the entire word under the cursor to lowercase.
yyp
The yyp command duplicates the current line by yanking it and immediately pasting it below.
daw
The daw command deletes a word including one side of its surrounding whitespace.
dd
The dd command deletes the entire current line, regardless of where the cursor is positioned on that line.
dit
The dit command deletes the text inside the nearest enclosing HTML or XML tag pair without removing the tags themselves.