autocmd on a List of Extensions
Yesterday I was VimScripting and learned that the autocmd
function can execute against multiple file extensions in a single line of setup. Here's a contrived example:
" ~/.vimrc
autocmd BufWritePost *.exs,*.ex :! git add %
In this code, after every buffer write on files matching .ex
and .exs
, add the current buffer to our Git staging area. Learning this helped me reduce duplication in my configuration.