How to automatically execute a shell command after

2019-01-30 14:24发布

This is because I'd like to automatically run tests after each file save.

I have looked at autocmd and BufWritePost but cannot make it work.

标签: vim autocmd
1条回答
兄弟一词,经得起流年.
2楼-- · 2019-01-30 14:26

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 *
查看更多
登录 后发表回答