开发者

Make a Vim plugin that calls a bash script

Sometimes I edit a file that represents a server restart. I would like to "bind" this restart to my vim session, so, after saving a file, it would call a bash script that woul开发者_C百科d restart for me.

For example, calling :wapache automatically calls restart_apache.sh somewhere in my machine.

Is this possible? Is there a plugin that would organize these scripts inside .vim directory?


You could presumably add something like the following to your vimrc:

autocmd BufWrite /etc/httpd/conf/* !restart_apache.sh

So that each time you save a file in the apache conf dir, vim executes your restart_apache.sh. You'd have to work out your permissions and what not.

I personally do not know of a script that manages these types of actions for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜