Skip to content

Instantly share code, notes, and snippets.

@qstrahl
Last active August 17, 2019 10:19
Show Gist options
  • Save qstrahl/08a399c4ffb5cef130799414b145d217 to your computer and use it in GitHub Desktop.
Save qstrahl/08a399c4ffb5cef130799414b145d217 to your computer and use it in GitHub Desktop.
" This is a very simple implementation of automatic :augroup -
" that is, whenever a vim script is sourced, that file will
" automatically default to a group name based on the path.
" It turns out this doesn't really break anything; scripts are
" still able to define their own augroups, it's just that they
" can't clobber other scripts' autocmds with a careless :au!
augroup init
autocmd! init SourceCmd * exe 'augroup' expand('<afile>:~:r') | source <afile> | exe 'augroup end'
augroup end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment