0

I want to write an autocmd pat that matches more than one file, eg:

" Source .vimrc after saving
autocmd! BufWritePost ($MYVIMRC,$MYGVIMRC) nested source % | echom "Reloaded " . expand('%') | redraw

:help pat doesn't give examples around the usage of (, {, | and ,

How do I achieve the desired result?

3
autocmd! BufWritePost $MYVIMRC,$MYGVIMRC {cmd....}
0

It should work if you use escaped parenthesis and escaped | sign as a delimiter, like so:

" Source .vimrc after saving
autocmd! BufWritePost \($MYVIMRC\|$MYGVIMRC\) CMD

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.