aboutsummaryrefslogtreecommitdiff
path: root/vim/vimrc
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-08 20:55:50 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-08 20:55:50 +1200
commitd7748a0d665ac099b498cc3f2b21215c601463d0 (patch)
tree885849949f683ca057099b296daf3b460247e0ad /vim/vimrc
parentRework a sentence (diff)
downloaddotfiles-d7748a0d665ac099b498cc3f2b21215c601463d0.tar.gz
dotfiles-d7748a0d665ac099b498cc3f2b21215c601463d0.zip
Adjust layout and fully document vimrc reload hook
Diffstat (limited to 'vim/vimrc')
-rw-r--r--vim/vimrc24
1 files changed, 17 insertions, 7 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 4da094fd..9495dee6 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -46,6 +46,23 @@ if !exists('$MYVIM') && &runtimepath !=# ''
endif
+" Create a 'vimrc' automatic command hook group, if it already exists, and
+" clear away any automatic command hooks already defined within it if it does,
+" so that we don't end up collecting multiple copies of the hooks configured
+" in the rest of this file if it's reloaded.
+"
+augroup vimrc
+ autocmd!
+augroup END
+
+" If this file or the vimrc stub that calls it is written to by Vim, reload
+" the stub vimrc and thereby the main vimrc, so that our changes apply
+" immediately in the current editing session. This often makes broken changes
+" immediately apparent.
+"
+autocmd vimrc BufWritePost $MYVIMRC,$MYVIM/vimrc
+ \ source $MYVIMRC
+
" Global indent settings go here. Filetype indent plugins will often refine
" these settings for individual buffers. For example, 'expandtab' is not
" appropriate for Makefiles, nor for the Go programming language. For
@@ -683,10 +700,3 @@ inoreabbrev wrnog wrong
inoreabbrev Fielding Feilding
inoreabbrev THe the
inoreabbrev THere there
-
-" Reload this file when I save it, modified or nay
-augroup vimrc
- autocmd!
- autocmd BufWritePost $MYVIMRC,$MYVIM/vimrc
- \ source $MYVIMRC
-augroup END