Last Updated: February 25, 2016
·
386
· nicktomlin

Run bash commands on open file

Useful for making sure a script isn't breaking things, or piping in data from a command . Helps maintain flow ^^

Run the current file in Python/PHP/Etc.

: !python % 

Source the current file:

: !source % 

Write the output of the command into the file ( in this case, print the path to the file's directory)

:r !pwd 

Legend:

: - Enter command mode
! - Run an external command
!! - Rerun the last external command
% - Refer to the current document
r - write the output of the external command into the file