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.
:set lazyredraw
When Vim runs a macro or an :argdo / :bufdo loop, it redraws the screen after every command by default.
<C-w>n
n creates a new empty buffer and opens it in a horizontal split above the current window.
<C-w>gf
gf reads the filename under the cursor and opens it in a new tab page, keeping your current buffer untouched.
/\Cpattern
Vim's ignorecase and smartcase settings change how all searches behave globally.
: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.
:helpgrep {pattern}
:helpgrep searches the full text of every Vim help file for a pattern and loads all matches into the quickfix list.
zl and zh
When a line is longer than the window width and wrap is off, Vim can display only part of it.
:set linebreak
By default, when wrap is enabled, Vim wraps long lines at the window edge — which can split words in the middle.
:put ={expression}
The :put command inserts the contents of a register as a new line below the cursor.
:let @q = '{keystrokes}'
You can assign a string directly to any register using :let @{reg} = '.
:vertical diffsplit {file}
Vim has a built-in diff mode that highlights added, removed, and changed lines between two (or more) buffers.
-
vim-vinegar is a lightweight plugin by Tim Pope that enhances Vim's built-in file browser (netrw) with a simpler, more intuitive workflow.