path: root/vim/ftdetect
diff options
authorTom Ryder <tom@sanctum.geek.nz>2017-10-30 14:26:26 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-30 14:26:26 +1300
commit0c1e3e08ed50f59c9d2d82ea27d74c1282f7bef4 (patch)
treea923ed9eb4d1f5ea9a98dd55aa57a86abfb6186b /vim/ftdetect
parent93b9d6c0188b075f06ec2b55221f12057eadd17b (diff)
Clear autocommands in ftdetect augroups
Clear autocommand definitions for each of the ftdetect augroups with `autocmd!` as the first command within them. This avoids ending up with doubled-up autocmd definitions if the configuration file is re-sourced, and is pretty standard good Vimscript practice. It's done correctly elsewhere in my Vim configuration, for example in config/undo.vim, but it's been unintentionally omitted here.
Diffstat (limited to 'vim/ftdetect')
3 files changed, 3 insertions, 0 deletions
diff --git a/vim/ftdetect/muttrc.vim b/vim/ftdetect/muttrc.vim
index ff3776b5..1800aff9 100644
--- a/vim/ftdetect/muttrc.vim
+++ b/vim/ftdetect/muttrc.vim
@@ -1,5 +1,6 @@
" Add automatic commands to detect .muttrc files
augroup dfmuttrc
+ autocmd!
autocmd BufNewFile,BufRead
\ **/.dotfiles/mutt/muttrc.d/*.rc
diff --git a/vim/ftdetect/sh.vim b/vim/ftdetect/sh.vim
index f2bc0df2..dce776cf 100644
--- a/vim/ftdetect/sh.vim
+++ b/vim/ftdetect/sh.vim
@@ -1,5 +1,6 @@
" Add automatic commands to choose shell flavours based on filename pattern
augroup dfsh
+ autocmd!
" Names/paths of things that are Bash shell script
autocmd BufNewFile,BufRead
diff --git a/vim/ftdetect/xdefaults.vim b/vim/ftdetect/xdefaults.vim
index f0ee7b81..bda1161a 100644
--- a/vim/ftdetect/xdefaults.vim
+++ b/vim/ftdetect/xdefaults.vim
@@ -1,5 +1,6 @@
" Add automatic commands to find Xresources subfiles
augroup dfxdefaults
+ autocmd!
autocmd BufNewFile,BufRead
\ **/.Xresources.d/*
\ setlocal filetype=xdefaults