Merge pull request #104 from t7ko/autoload-fix

Don't source base.vim at Vim startup
This commit is contained in:
EinfachToll 2015-02-04 14:36:23 +01:00
commit e34e160a34
2 changed files with 21 additions and 23 deletions

View File

@ -8,26 +8,8 @@ if exists("g:loaded_vimwiki_auto") || &cp
endif
let g:loaded_vimwiki_auto = 1
" MISC helper functions {{{
function! vimwiki#base#get_known_extensions() " {{{
" Getting all extensions that different wikis could have
let extensions = {}
for wiki in g:vimwiki_list
if has_key(wiki, 'ext')
let extensions[wiki.ext] = 1
else
let extensions['.wiki'] = 1
endif
endfor
" append map g:vimwiki_ext2syntax
for ext in keys(g:vimwiki_ext2syntax)
let extensions[ext] = 1
endfor
return keys(extensions)
endfunction " }}}
function! vimwiki#base#get_known_syntaxes() " {{{
" s:vimwiki_get_known_syntaxes
function! s:vimwiki_get_known_syntaxes() " {{{
" Getting all syntaxes that different wikis could have
let syntaxes = {}
let syntaxes['default'] = 1
@ -42,7 +24,6 @@ function! vimwiki#base#get_known_syntaxes() " {{{
endfor
return keys(syntaxes)
endfunction " }}}
" }}}
" vimwiki#base#apply_wiki_options
function! vimwiki#base#apply_wiki_options(options) " {{{ Update the current
@ -1940,7 +1921,7 @@ endfunction " }}}
" -------------------------------------------------------------------------
" Load syntax-specific Wiki functionality
for s:syn in vimwiki#base#get_known_syntaxes()
for s:syn in s:vimwiki_get_known_syntaxes()
execute 'runtime! autoload/vimwiki/'.s:syn.'_base.vim'
endfor
" -------------------------------------------------------------------------

View File

@ -357,6 +357,23 @@ function! VimwikiClear(option, ...) "{{{
endfunction "}}}
" }}}
function! s:vimwiki_get_known_extensions() " {{{
" Getting all extensions that different wikis could have
let extensions = {}
for wiki in g:vimwiki_list
if has_key(wiki, 'ext')
let extensions[wiki.ext] = 1
else
let extensions['.wiki'] = 1
endif
endfor
" append map g:vimwiki_ext2syntax
for ext in keys(g:vimwiki_ext2syntax)
let extensions[ext] = 1
endfor
return keys(extensions)
endfunction " }}}
" }}}
" CALLBACK functions "{{{
@ -486,7 +503,7 @@ augroup end
augroup vimwiki
autocmd!
for s:ext in vimwiki#base#get_known_extensions()
for s:ext in s:vimwiki_get_known_extensions()
exe 'autocmd BufEnter *'.s:ext.' call s:setup_buffer_reenter()'
exe 'autocmd BufWinEnter *'.s:ext.' call s:setup_buffer_enter()'
exe 'autocmd BufLeave,BufHidden *'.s:ext.' call s:setup_buffer_leave()'