How do I insert the filename under the cursor directly into the command line?
<C-r><C-f>
While typing a command, inserts the filename under the cursor in the buffer at the command-line prompt.
Search Vim Tricks
Searching...<C-r><C-f>
While typing a command, inserts the filename under the cursor in the buffer at the command-line prompt.
g_
g moves the cursor to the last non-blank character of the current line — skipping trailing spaces and tabs.
:ldo execute 'normal @q'
:ldo runs an Ex command on each entry in the location list — the buffer-local cousin of the quickfix list.
guu / gUU
Vim's case operators gu (lowercase) and gU (uppercase) follow the same doubling convention as dd and yy: repeating the operator letter applies it to the whole c
:ls!
:ls (or :buffers) shows Vim's buffer list, but it hides unlisted buffers — help files, directory listings (netrw), terminal buffers, and scratch buffers marke
"/p
Vim stores the last search pattern in the search register "/.
:set pumheight=10
By default, Vim's completion popup menu (the PUM — Pop-Up Menu) can expand to fill the entire screen if there are many candidates.
<C-a> / <C-x> (vim-speeddating)
vim-speeddating (by Tim Pope) extends Vim's built-in and increment/decrement operators to understand dates, times, roman numerals, and other ordered sequences.
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.