From d7748a0d665ac099b498cc3f2b21215c601463d0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 8 Jun 2019 20:55:50 +1200 Subject: Adjust layout and fully document vimrc reload hook --- vim/vimrc | 24 +++++++++++++++++------- 1 file 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 -- cgit v1.2.3