How do I change the case of selected text in visual mode?
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
Search Vim Tricks
Searching...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.
<C-w>x
How it works The x command exchanges the current window with the next one.
:b N
How it works Every buffer in Vim is assigned a unique number when it is opened.
:CocInstall coc-tsserver
coc.
:'<,'>move'>+1 or :'<,'>move'<-2
How it works Vim's :move command lets you relocate lines to a different position.
<C-w>h / <C-w>j / <C-w>k / <C-w>l
How it works Vim lets you navigate between split windows using followed by a direction key.
let @a = 'sequence'
How it works Macros recorded with q are stored in registers, but they are lost when you close Vim (unless you have the viminfo or shada file preserving them).
viw
How it works The command viw selects the word under the cursor in visual mode.