How do I visually select a code block enclosed in curly braces including the braces themselves?
vaB
The aB text object (around Block) selects everything from the matching { to the closing } — including the braces themselves.
vaB
The aB text object (around Block) selects everything from the matching { to the closing } — including the braces themselves.
:argdo execute 'normal @q' | update
:argdo runs an Ex command on every file in Vim's argument list (the arglist).
<C-r>0
In Insert mode, {reg} pastes the contents of any register inline at the cursor.
<C-g>u
By default, Vim treats an entire Insert mode session (from entering Insert mode to pressing ) as a single undo unit.
<C-w>n
n creates a new empty buffer and opens it in a horizontal split above the current window.
:args **/*.py
Vim's argument list (arglist) is a named list of files that you can operate on as a group.
:Rename {newname}
vim-eunuch (by Tim Pope) adds Unix shell operations as first-class Vim commands.
vis
The is (inner sentence) text object selects the sentence the cursor is in — excluding any leading or trailing whitespace that separates sentences.
:t.
The :t (short for :copy) command copies lines from one location to another.
:%!{command}
The ! filter command in Vim sends a range of lines to an external program as standard input, then replaces those lines with the program's standard output.
:put ={expression}
The :put command inserts the contents of a register as a new line below the cursor.
va"
Vim's text objects let you select structured regions of text with two-keystroke shortcuts.
r<CR>
You can split a line at the cursor without entering Insert mode by using r.
:saveas
The :saveas {filename} command writes the current buffer to a new file and makes that new file the current buffer's file.
cr
The vim-abolish plugin (by tpope) provides a cr (coerce) operator that converts the word under the cursor between naming conventions with a single keystroke pai
<C-v>I#<Esc>
Vim's Visual Block mode lets you prepend characters (like comment markers) to multiple lines simultaneously.
<C-t> / <C-d>
While in Insert mode, you can adjust indentation without switching back to Normal mode.
cs'"
The vim-surround plugin (by Tim Pope) adds three powerful operators for working with surrounding delimiters — quotes, brackets, parentheses, and HTML tags.
"qp
Macros are stored as plain text in named registers.
:v/pattern/command
:v (short for :vglobal) is the inverse of :g.