How do I navigate by WORD boundaries that include punctuation in Vim?
W, B, and E
How it works Vim distinguishes between two types of word objects: A word (lowercase w, b, e) is a sequence of letters, digits, and underscores, or a sequence of
W, B, and E
How it works Vim distinguishes between two types of word objects: A word (lowercase w, b, e) is a sequence of letters, digits, and underscores, or a sequence of
v%
How it works The % motion jumps to the matching bracket, parenthesis, or brace.
:nnoremap <buffer> <leader>r :!python %<CR>
How it works By adding to a mapping command, the mapping only applies to the current buffer.
qa<C-r>=expression<CR>q
How it works The expression register (=) lets you evaluate Vimscript expressions and insert the result.
:set winfixwidth winfixheight
How it works When you open new split windows in Vim, the existing windows automatically resize to make room.
M to move to the middle, L to move to the bottom
How it works Vim offers three commands to jump the cursor to specific vertical positions on the visible screen without scrolling: H moves to the top of the scre
qabi"<Esc>ea"<Esc>wq
How it works This macro wraps the current word in double quotes and moves to the next word, making it easy to repeat across a line or file.
U, u, or ~ in visual mode
How it works When you have text selected in visual mode, you can change its case with three simple keys: U - Convert the entire selection to UPPERCASE u - Conve
:!ls -la
Vim lets you execute any shell command directly from within the editor using the :! (bang) command.
qa:s/old/new/g<CR>jq
How it works You can combine Ex commands like :s (substitute) with macro recording to create powerful repeatable find-and-replace operations that go beyond what
do (diffget) / dp (diffput)
How it works When you open two files in diff mode (using vim -d file1 file2 or :windo diffthis), Vim highlights the differences between them.
:%bd | e#
How it works Vim does not have a built-in single command to close all buffers except the current one, but you can achieve this with a two-part command: :%bd e#.
qa0f:dwj0q
How it works When recording a macro that you plan to repeat across multiple lines, the key technique is to end the macro positioned on the next line, ready for
<C-w>}
How it works The } command opens a preview window showing the tag definition of the word under your cursor.
:tab sb N
How it works The :tab sb N command opens buffer number N in a brand new tab page.
autoload/myplugin.vim
The autoload mechanism in Vim lets you write plugins whose functions are only loaded into memory when they are first called.
qaq
How it works To clear a macro register, you simply start recording into that register and immediately stop.
<C-w>f
How it works You may already know that gf opens the file path under the cursor in the current window.
v, V, or Ctrl-V while in visual mode
How it works Vim has three visual modes, and you can switch between them without losing your current selection: v - Characterwise visual mode (select individual
:DB sqlite:mydb.sqlite SELECT * FROM users
vim-dadbod by Tim Pope is a plugin that lets you interact with databases directly from Vim.