Is it possible to use variables or lists to pass patterns to vim's autocmd?
Here is an example:
" Automatically source .vimrc if there have been any changes
let candidates = [ ".vimrc", "_vimrc", "vimrc", ".gvimrc", "_gvimrc", "gvimrc" ]
augroup AutoSourceVimrc
autocmd!
autocmd BufWritePost candidates so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
augroup END
The example above does not work - unfortunately.
Here is a simpler version of your command: