Reputation: 12752
This is because I'd like to automatically run tests after each file save.
I have looked at autocmd
and BufWritePost
, but I cannot make it work.
Upvotes: 88
Views: 43004
Reputation: 21597
Put this into your .vimrc
file:
(take raml2html doc/api.raml > public/api_doc.html
as a command example)
autocmd BufWritePost,FileWritePost *.raml silent! !raml2html doc/api.raml > public/api_doc.html
Notice:
silent!
will hide all the output of this command:silent
if you are using Vim 7.3 or less, and silent!
if using Vim 7.3 and later.vimrc
take effect.Upvotes: 1
Reputation: 1341
This runs run_tests.sh
after any file is saved, with the current filename as the only parameter:
:autocmd BufWritePost * !run_tests.sh <afile>
View the auto-command with:
:autocmd BufWritePost *
And remove all auto-commands from the previous with:
:autocmd! BufWritePost *
Upvotes: 116