How do I insert the output of a shell command into my buffer?
:read !date
The :read !{command} syntax runs a shell command and inserts its output below the current line.
:read !date
The :read !{command} syntax runs a shell command and inserts its output below the current line.
:%!tac
Vim doesn't have a built-in reverse command, but you can pipe the buffer through tac (reverse of cat) to flip line order.
:center 80
Vim has built-in text alignment commands that adjust lines relative to a specified width.
cia (with targets.vim) or daa
While Vim doesn't have a built-in argument text object, the targets.
<C-k>DG
Vim's digraph system lets you insert special characters by pressing followed by a two-character mnemonic code.
<C-r>=2+2<CR>
The expression register (=) in insert mode lets you evaluate any Vimscript expression and insert the result inline.
:cnoremap <C-a> <Home>
Vim's command line has limited navigation by default.
<C-w>_ and <C-w>|
When working with multiple splits, you sometimes need to focus on one window temporarily without closing the others.
:set suffixesadd+=.js,.ts,.py
In many programming languages, import statements reference modules without file extensions (e.
:set virtualedit=block
By default, Vim's visual block mode () is limited by line length — if some lines are shorter than others, the block selection gets ragged.
<C-f> (from command-line mode)
When you are partway through typing a long or complex Ex command on the : prompt, you can press to open the command-line window.
:keeppattern %s/old/new/g
When you run a :s or :%s substitute command, Vim updates the search register (@/) with the substitution pattern.
command-line #ex-commands #search #editing #registers #substitute
:%norm! A;
The :norm! (or :normal!) command executes normal mode keystrokes while ignoring all user-defined mappings.
:checktime
The :checktime command tells Vim to check whether any open buffers have been modified outside of Vim and prompt you to reload them.
:bufdo %s/old/new/ge | update
The :bufdo command executes an Ex command in every loaded buffer.
buffers-windows #buffers #ex-commands #editing #substitution
<C-r>=system("date")<CR>
The expression register (=) is one of Vim's most powerful yet underused features.
g; and g,
Vim tracks every position where you made a change in the changelist.
qqq qq{commands}@qq @q
A recursive macro calls itself at the end of its recording, causing it to repeat automatically until a motion fails (like j at the last line).
:let @+ = expand('%:p')
Sometimes you need to share or use the full path of the file you're editing — for a terminal command, a config file, or a chat message.
:argdo %s/old/new/g | update
The :argdo command runs an Ex command on every file in the argument list (the files you opened Vim with, or added via :argadd).