How to run Unix commands from within Vim

unixvim

How can I run Unix commands while I'm inside vim?

Best Answer

Go to command mode Esc, then run :!unix_command. Anything run from the : prompt starting with a bang ! will be run as a unix shell command. You'll be shown the output and allowed to hit a key to get back to your work in vim.

If you have text selected in visual mode and want to send it TO a command as STDIN, hit !! and enter your command. The results of the command will replace the text you have selected.

Related Question