diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-10 17:20:39 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-10 17:20:39 +1200 |
commit | c7e07c5c0c3c35698558ab6801cf80065d5c26a4 (patch) | |
tree | 7a4a45909e2593c021afc366fb47968da698fc3e | |
parent | Merge branch 'hotfix/v5.33.1' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-c7e07c5c0c3c35698558ab6801cf80065d5c26a4.tar.gz dotfiles-c7e07c5c0c3c35698558ab6801cf80065d5c26a4.zip |
Merge branch 'release/v5.34.0'v5.34.0
* release/v5.34.0:
Explicitly set colorscheme to default on load fail
Refactor vimrc reload and source hooks
Add bang to :command declaration so they redefine
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/vimrc | 45 |
2 files changed, 23 insertions, 26 deletions
@@ -1,2 +1,2 @@ -tejr dotfiles v5.33.1 -Mon Jun 10 04:17:28 UTC 2019 +tejr dotfiles v5.34.0 +Mon Jun 10 05:03:19 UTC 2019 @@ -175,23 +175,11 @@ augroup vimrc autocmd! augroup END -" If this file or the vimrc stub that calls it is written to by Vim, we'd like -" to 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 - \ source $MYVIMRC -if $MYVIMRC !=# '' - autocmd vimrc BufWritePost $MYVIM/vimrc - \ doautocmd vimrc BufWritePost $MYVIMRC -endif - -" Similarly, if this file or the vimrc stub that calls it is sourced, whether -" because of the above hook, or the <Leader>R mapping prescribed later in this -" file, add a hook that re-runs filetype detection and thereby ftplugin -" loading. This is chiefly so that any global options set in this file don't -" trample over needed buffer-local settings. +" If this file or the vimrc stub that calls it is sourced, whether because of +" the above hook, or the <Leader>R mapping prescribed later in this file, add +" a hook that re-runs filetype detection and thereby ftplugin loading. This +" is chiefly so that any global options set in this file don't trample over +" needed buffer-local settings. " " We'll abstract this away a bit behind a new user command named " FileTypeReload, which just re-runs BufRead events for filetype detection if @@ -216,12 +204,21 @@ command! FileTypeReload " exists first. " if exists('##SourceCmd') - autocmd vimrc SourceCmd $MYVIMRC - \ source <afile> | FileTypeReload - if $MYVIM !=# '' - autocmd vimrc SourceCmd $MYVIM/vimrc - \ doautocmd vimrc SourceCmd $MYVIMRC - endif + autocmd vimrc SourceCmd $MYVIMRC,$MYVIM/vimrc + \ source <sfile> | FileTypeReload +endif + +" If this file or the vimrc stub that calls it is written to by Vim, we'd like +" to 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. We can lean on the SourceCmd hook we just +" established to do this; in fact, we'll only establish this hook if we can do +" so, because otherwise filetype plugins won't reload, and options like +" 'shiftwidth' might be set incorrectly. +" +if exists('#vimrc#SourceCmd') + autocmd vimrc BufWritePost $MYVIMRC,$MYVIM/vimrc + \ doautocmd vimrc SourceCmd endif " Keep the viminfo file in a cache subdirectory of the user runtime directory, @@ -955,7 +952,7 @@ try colorscheme sahara set cursorline catch - syntax reset + colorscheme default set background=dark set nocursorline endtry |