From 572a53b988e37f9a5f74392d95a6e9080349a548 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 26 May 2019 22:36:16 +1200 Subject: Move code out to autoload --- autoload/vimrc_reload_filetype.vim | 9 +++++++++ plugin/vimrc_reload_filetype.vim | 15 +++------------ 2 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 autoload/vimrc_reload_filetype.vim diff --git a/autoload/vimrc_reload_filetype.vim b/autoload/vimrc_reload_filetype.vim new file mode 100644 index 0000000..6e4d4b8 --- /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 + if exists('#filetypedetect#BufRead') + doautocmd filetypedetect BufRead + endif + redraw + echomsg 'Reloaded vimrc: '.expand('') +endfunction 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 - if exists('#filetypedetect#BufRead') - doautocmd filetypedetect BufRead - endif - redraw - echomsg 'Reloaded vimrc: '.expand('') -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 -- cgit v1.2.3 From 890fd7da4a1fae1c0b3d806875c9f50271c47ce8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 26 May 2019 23:55:25 +1200 Subject: Adjust use of $MYVIMRC and expansion --- autoload/vimrc_reload_filetype.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/vimrc_reload_filetype.vim b/autoload/vimrc_reload_filetype.vim index 6e4d4b8..cc8df98 100644 --- a/autoload/vimrc_reload_filetype.vim +++ b/autoload/vimrc_reload_filetype.vim @@ -1,9 +1,9 @@ " Wrapper function reloads .vimrc and filetypes function! vimrc_reload_filetype#Reload() abort - source + source $MYVIMRC if exists('#filetypedetect#BufRead') doautocmd filetypedetect BufRead endif redraw - echomsg 'Reloaded vimrc: '.expand('') + echomsg 'Reloaded vimrc: '.fnamemodify($MYVIMRC, ':p:~') endfunction -- cgit v1.2.3 From 59906e7ca04d153d127f7917d227482a0831532e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 26 May 2019 23:57:15 +1200 Subject: Remove literal message documentation --- README.md | 2 +- doc/vimrc_reload_filetype.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aa46047..7a3230c 100644 --- a/README.md +++ b/README.md @@ -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 ------- 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* -- cgit v1.2.3 From e088b5e51582834b6d81b7d80befb82222764c77 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 26 May 2019 23:57:36 +1200 Subject: Bump VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 0ea3a94..3eefcb9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.0 +1.0.0 -- cgit v1.2.3