diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 6a87cf4..4bc45af 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -378,7 +378,7 @@ function! vimwiki#base#find_files(wiki_nr, directories_only) " if current wiki is temporary -- was added by an arbitrary wiki file then do " not search wiki files in subdirectories. Or it would hang the system if " wiki file was created in $HOME or C:/ dirs. - if vimwiki#vars#get_wikilocal('temp', wiki_nr) + if vimwiki#vars#get_wikilocal('is_temporary_wiki', wiki_nr) let pattern = '*'.ext else let pattern = '**/*'.ext @@ -707,11 +707,15 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...) "{{{ " getpos() directly after this command. Strange. if !(a:command ==# ':e ' && vimwiki#path#is_equal(a:filename, expand('%:p'))) execute a:command.' '.fname + + " If the opened file was not already loaded by Vim, an autocommand is + " triggered at this point + " Make sure no other plugin takes ownership over the new file. Vimwiki " rules them all! Well, except for directories, which may be opened with " Netrw if &filetype != 'vimwiki' && fname !~ '\m/$' - set filetype=vimwiki + setfiletype vimwiki endif endif if a:anchor != '' diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim index 2872796..93e77ba 100644 --- a/autoload/vimwiki/vars.vim +++ b/autoload/vimwiki/vars.vim @@ -192,6 +192,7 @@ function! s:populate_wikilocal_options() let g:vimwiki_wikilocal_vars = [] + " set the wiki-local variables according to g:vimwiki_list (or the default settings) if exists('g:vimwiki_list') for users_options in g:vimwiki_list let new_wiki_settings = {} @@ -205,8 +206,7 @@ function! s:populate_wikilocal_options() endif endfor - " is it a temporary wiki? No, it's not. - let new_wiki_settings.temp = 0 + let new_wiki_settings.is_temporary_wiki = 0 call add(g:vimwiki_wikilocal_vars, new_wiki_settings) endfor @@ -221,7 +221,7 @@ function! s:populate_wikilocal_options() let temporary_options_dict[key] = default_values[key] endif endfor - let temporary_options_dict.temp = 1 + let temporary_options_dict.is_temporary_wiki = 1 call add(g:vimwiki_wikilocal_vars, temporary_options_dict) call s:validate_settings() @@ -250,10 +250,13 @@ function! vimwiki#vars#populate_syntax_vars(syntax) if !exists('g:vimwiki_syntax_variables') let g:vimwiki_syntax_variables = {} endif - if !has_key(g:vimwiki_syntax_variables, a:syntax) - let g:vimwiki_syntax_variables[a:syntax] = {} + + if has_key(g:vimwiki_syntax_variables, a:syntax) + return endif + let g:vimwiki_syntax_variables[a:syntax] = {} + execute 'runtime! syntax/vimwiki_'.a:syntax.'.vim' " generic stuff diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index e5763f3..af6758b 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -13,7 +13,8 @@ let b:did_ftplugin = 1 " Don't load another plugin for this buffer let b:undo_ftplugin = "setlocal ". \ "suffixesadd< isfname< formatlistpat< ". \ "formatoptions< foldtext< ". - \ "foldmethod< foldexpr< commentstring< " + \ "foldmethod< foldexpr< commentstring< tags< omnifunc< autoindent< ". + \ "smartindent< cindent< comments< formatoptions<" " UNDO }}} " MISC STUFF {{{ diff --git a/plugin/vimwiki.vim b/plugin/vimwiki.vim index 13797f8..0c25daf 100644 --- a/plugin/vimwiki.vim +++ b/plugin/vimwiki.vim @@ -61,8 +61,9 @@ function! s:setup_new_wiki_buffer() "{{{ endif endif - " this makes that ftplugin/vimwiki.vim is sourced - set filetype=vimwiki + " this makes that ftplugin/vimwiki.vim and afterwards syntax/vimwiki.vim are + " sourced + setfiletype vimwiki " to force a rescan of the filesystem which may have changed " and update VimwikiLinks syntax group that depends on it; @@ -86,7 +87,7 @@ function! s:setup_buffer_enter() "{{{ let &autowriteall = vimwiki#vars#get_global('autowriteall') if &filetype == '' - set filetype=vimwiki + setfiletype vimwiki elseif &syntax ==? 'vimwiki' " to force a rescan of the filesystem which may have changed " and update VimwikiLinks syntax group that depends on it; diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim index b6f6d48..0981aee 100644 --- a/syntax/vimwiki.vim +++ b/syntax/vimwiki.vim @@ -311,7 +311,9 @@ if vimwiki#vars#get_global('hl_headers') == 0 endfor else for s:i in range(1,6) - execute 'hi def VimwikiHeader'.s:i.' guibg=bg guifg='.vimwiki#vars#get_global('hcolor_guifg_'.&bg)[s:i-1].' gui=bold ctermfg='.vimwiki#vars#get_global('ctermfg_'.&bg)[s:i-1].' term=bold cterm=bold' + execute 'hi def VimwikiHeader'.s:i.' guibg=bg guifg=' + \ .vimwiki#vars#get_global('hcolor_guifg_'.&bg)[s:i-1].' gui=bold ctermfg=' + \ .vimwiki#vars#get_global('hcolor_ctermfg_'.&bg)[s:i-1].' term=bold cterm=bold' endfor endif "}}}