diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | autoload/vimrc_reload_filetype.vim | 9 | ||||
-rw-r--r-- | doc/vimrc_reload_filetype.txt | 2 | ||||
-rw-r--r-- | plugin/vimrc_reload_filetype.vim | 15 |
5 files changed, 15 insertions, 15 deletions
@@ -6,7 +6,7 @@ with a command to reload filetype detection and filetype plugin loading for the current buffer, to correct the issue of `vimrc` `:set` commands clobbering filetype-specific `:setlocal` options. -It also echoes a nice "Reloaded vimrc" message so you know it's working. +It also echoes a nice message so you know it's working. License ------- @@ -1 +1 @@ -0.2.0 +1.0.0 diff --git a/autoload/vimrc_reload_filetype.vim b/autoload/vimrc_reload_filetype.vim new file mode 100644 index 0000000..cc8df98 --- /dev/null +++ b/autoload/vimrc_reload_filetype.vim @@ -0,0 +1,9 @@ +" Wrapper function reloads .vimrc and filetypes +function! vimrc_reload_filetype#Reload() abort + source $MYVIMRC + if exists('#filetypedetect#BufRead') + doautocmd filetypedetect BufRead + endif + redraw + echomsg 'Reloaded vimrc: '.fnamemodify($MYVIMRC, ':p:~') +endfunction diff --git a/doc/vimrc_reload_filetype.txt b/doc/vimrc_reload_filetype.txt index eb9f446..65563b0 100644 --- a/doc/vimrc_reload_filetype.txt +++ b/doc/vimrc_reload_filetype.txt @@ -7,7 +7,7 @@ with a command to reload filetype detection and filetype plugin loading for the current buffer, to correct the issue of |vimrc| |:set| commands clobbering filetype-specific |:setlocal| options. -It also echoes a nice "Reloaded vimrc" message so you know it's working. +It also echoes a nice message so you know it's working. REQUIREMENTS *vimrc_reload_filetype-requirements* diff --git a/plugin/vimrc_reload_filetype.vim b/plugin/vimrc_reload_filetype.vim index 34ff8d7..de23a8b 100644 --- a/plugin/vimrc_reload_filetype.vim +++ b/plugin/vimrc_reload_filetype.vim @@ -9,23 +9,14 @@ if exists('loaded_vimrc_reload_filetype') || &compatible finish endif -if !has('autocmd') || !exists('##SourceCmd') +if !exists('##SourceCmd') finish endif let loaded_vimrc_reload_filetype = 1 -" Wrapper function reloads .vimrc and filetypes -function! s:Reload() abort - source <afile> - if exists('#filetypedetect#BufRead') - doautocmd filetypedetect BufRead - endif - redraw - echomsg 'Reloaded vimrc: '.expand('<afile>') -endfunction - " This SourceCmd intercepts :source for .vimrc augroup vimrc_reload_filetype autocmd! - autocmd SourceCmd $MYVIMRC call s:Reload() + autocmd SourceCmd $MYVIMRC + \ call vimrc_reload_filetype#Reload() augroup END |