menu

How to Execute a script directly within vi/vim

Short Answer:

» Answer from Stack Overflow

You can do this in vim using the ! command. For instance to count the number of words in the current file you can do:

:! wc %

The % is replaced by the current filename. To run a script you could call the interpreter on the file - for instance if you are writing a python script:

:! python %



KF

Comments