Apache restart with Vim autocmd

In order to execute a command right after saving a file in Vim, you can use the :autocmd command. Here is a quick example how it can be useful with Apache files.

NB: on my system, Debian in this case, an Apache file is automatically recognized as filetype=apache.

augroup apache
    autocmd BufWritePost */sites-enabled/* !/etc/init.d/apache2 restart
augroup END

1 comment:

  1. This... is gonna improve my life by about 37%.