Executing Shell commands inside Vim

Shell commands can be executed inside vim. You can use ! after the : and type in your command. You need to know just one more thing and you can be off. The current file is specified by the % character. For for example, if you want to find the word count of the current file, type in, :! wc %. If you want for example to execute the script you are writing then :! bash %, will run the current bash script you are writing. The display will momentarily go out of vim to display the results but will be back to vim as soon as you hit Enter.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s