How do I view the contents of all registers in Vim?
:registers
The :registers command displays the contents of all Vim registers, showing you exactly what text is stored in each one.
:registers
The :registers command displays the contents of all Vim registers, showing you exactly what text is stored in each one.
<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.
/pattern
The /pattern command searches forward through the file for the given pattern.
#
The # command searches backward for the exact word under the cursor, jumping to the previous occurrence.
*
The command searches forward for the exact word under the cursor, jumping to the next occurrence.
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 colorcolumn=80
The :set colorcolumn=80 command displays a vertical highlight at column 80, giving you a visual guide for line length.
ma and 'a
The ma command sets a mark named a at the current cursor position.
:set relativenumber
The :set relativenumber command displays line numbers relative to the cursor position instead of absolute line numbers.
:set tabstop=4 shiftwidth=4 expandtab
The :set tabstop=4 shiftwidth=4 expandtab command configures Vim to use 4-space indentation with spaces instead of tab characters.
: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.