aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-26 22:36:16 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-26 22:36:16 +1200
commit572a53b988e37f9a5f74392d95a6e9080349a548 (patch)
treed508c7022f361ab6d175b53faea07ceddc6f3ba5 /plugin
parentMerge branch 'release/v0.2.0' into develop (diff)
downloadvim-vimrc-reload-filetype-572a53b988e37f9a5f74392d95a6e9080349a548.tar.gz
vim-vimrc-reload-filetype-572a53b988e37f9a5f74392d95a6e9080349a548.zip
Move code out to autoload
Diffstat (limited to 'plugin')
-rw-r--r--plugin/vimrc_reload_filetype.vim15
1 files changed, 3 insertions, 12 deletions
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