Sometimes you need to fetch some data or the results of a shell command and insert it into your current buffer of
vim. You could copy and paste this from one window to another or use
tmux to copy to the clipboard and paste into
vim. Or… You could do it straight from
vim - like so…
:read !ls -lah
:– VIM colon command prompt
read– insert what comes to the right of the read command into the current buffer
!– execute shell command
ls -lah– directory listing on a *nix OS
And for something spiffy, insert the result of a math calculation!
:read !expr 160170 / 2
:read !echo "like a boss!"