How do I reselect the last visual selection?
gv
The gv command reselects the exact same area that was last selected in visual mode.
gv
The gv command reselects the exact same area that was last selected in visual mode.
:'<,'>normal @a
The :'normal @a command executes the macro stored in register a on every line within the current visual selection.
:!command
The :!command syntax lets you execute any shell command directly from within Vim without leaving the editor.
:s/old/new/g
The :s/old/new/g command replaces all occurrences of old with new on the current line only.
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.
"+p
The "+p command pastes the contents of the system clipboard into Vim.
>>
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.
:r !command
The :r !command command executes a shell command and inserts its output directly into the current buffer below the cursor line.
J
The J command joins the current line with the line below it, replacing the newline with a space.
`.
The ` .
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.
"ap, edit, "ayy
Vim stores macros in registers, which means you can paste a macro's contents into a buffer, edit it as regular text, and yank it back into the register.
:set spell
The :set spell command activates Vim's built-in spell checker, which highlights misspelled words directly in your buffer.
:syntax on
The :syntax on command enables syntax highlighting in Vim, colorizing your code based on the file type.
:g/pattern/normal dd
The :g/pattern/normal {commands} command executes normal mode keystrokes on every line in the file that matches the given pattern.