From 61910cd93ac4418a629fe135f8437f2b6f50e661 Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Thu, 22 Dec 2016 19:12:03 +0100 Subject: [PATCH] Use new access functions for wiki-local variables -- part 2 Ref #256 --- autoload/vimwiki/html.vim | 12 ++++++------ autoload/vimwiki/vars.vim | 1 + ftplugin/vimwiki.vim | 4 ++-- plugin/vimwiki.vim | 12 ++---------- syntax/vimwiki.vim | 4 ++-- 5 files changed, 13 insertions(+), 20 deletions(-) diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim index 7da33cd..b6310b7 100644 --- a/autoload/vimwiki/html.vim +++ b/autoload/vimwiki/html.vim @@ -88,13 +88,13 @@ endfunction "}}} function! s:template_full_name(name) "{{{ if a:name == '' - let name = VimwikiGet('template_default') + let name = vimwiki#vars#get_wikilocal('template_default') else let name = a:name endif - let fname = expand(VimwikiGet('template_path'). - \ name.VimwikiGet('template_ext')) + let fname = expand(vimwiki#vars#get_wikilocal('template_path'). + \ name . vimwiki#vars#get_wikilocal('template_ext')) if filereadable(fname) return fname @@ -1361,9 +1361,9 @@ function! vimwiki#html#CustomWiki2HTML(path, wikifile, force) "{{{ \ shellescape(a:path). ' '. \ shellescape(a:wikifile). ' '. \ shellescape(s:default_CSS_full_name(a:path)). ' '. - \ (len(VimwikiGet('template_path')) > 1 ? shellescape(expand(VimwikiGet('template_path'))) : '-'). ' '. - \ (len(VimwikiGet('template_default')) > 0 ? VimwikiGet('template_default') : '-'). ' '. - \ (len(VimwikiGet('template_ext')) > 0 ? VimwikiGet('template_ext') : '-'). ' '. + \ (len(vimwiki#vars#get_wikilocal('template_path')) > 1 ? shellescape(expand(vimwiki#vars#get_wikilocal('template_path'))) : '-'). ' '. + \ (len(vimwiki#vars#get_wikilocal('template_default')) > 0 ? vimwiki#vars#get_wikilocal('template_default') : '-'). ' '. + \ (len(vimwiki#vars#get_wikilocal('template_ext')) > 0 ? vimwiki#vars#get_wikilocal('template_ext') : '-'). ' '. \ (len(VimwikiGet('subdir')) > 0 ? shellescape(s:root_path(VimwikiGet('subdir'))) : '-')) endfunction " }}} diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim index ca7fd5d..d9151d9 100644 --- a/autoload/vimwiki/vars.vim +++ b/autoload/vimwiki/vars.vim @@ -101,6 +101,7 @@ function! s:populate_wikilocal_options() \ 'auto_export': 0, \ 'auto_tags': 0, \ 'auto_toc': 0, + \ 'automatic_nested_syntaxes': 1, \ 'css_name': 'style.css', \ 'custom_wiki2html': '', \ 'diary_header': 'Diary', diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 3c1bd03..1308a63 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -639,7 +639,7 @@ nnoremap VimwikiRemoveHeaderLevel : " KEYBINDINGS }}} " AUTOCOMMANDS {{{ -if VimwikiGet('auto_export') +if vimwiki#vars#get_wikilocal('auto_export') " Automatically generate HTML on page write. augroup vimwiki au BufWritePost @@ -648,7 +648,7 @@ if VimwikiGet('auto_export') augroup END endif -if VimwikiGet('auto_toc') +if vimwiki#vars#get_wikilocal('auto_toc') " Automatically update the TOC *before* the file is written augroup vimwiki au BufWritePre call vimwiki#base#table_of_contents(0) diff --git a/plugin/vimwiki.vim b/plugin/vimwiki.vim index 066fe3c..9aa8d80 100644 --- a/plugin/vimwiki.vim +++ b/plugin/vimwiki.vim @@ -42,8 +42,8 @@ endfunction "}}} function! Validate_wiki_options(idx) " {{{ call VimwikiSet('path', s:normalize_path(VimwikiGet('path', a:idx)), a:idx) call VimwikiSet('path_html', s:normalize_path(s:path_html(a:idx)), a:idx) - call VimwikiSet('template_path', - \ s:normalize_path(VimwikiGet('template_path', a:idx)), a:idx) + call vimwiki#vars#set_wikilocal('template_path', + \ s:normalize_path(vimwiki#vars#get_wikilocal('template_path', a:idx)), a:idx) call vimwiki#vars#set_wikilocal('diary_rel_path', \ s:normalize_path(vimwiki#vars#get_wikilocal('diary_rel_path', a:idx)), a:idx) endfunction " }}} @@ -328,14 +328,6 @@ let s:vimwiki_defaults.ext = '.wiki' let s:vimwiki_defaults.maxhi = 0 let s:vimwiki_defaults.syntax = 'default' -let s:vimwiki_defaults.template_path = '~/vimwiki/templates/' -let s:vimwiki_defaults.template_default = 'default' -let s:vimwiki_defaults.template_ext = '.tpl' - -let s:vimwiki_defaults.nested_syntaxes = {} -let s:vimwiki_defaults.automatic_nested_syntaxes = 1 -let s:vimwiki_defaults.auto_export = 0 -let s:vimwiki_defaults.auto_toc = 0 " is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki " file. let s:vimwiki_defaults.temp = 0 diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim index 8184e9e..b16159f 100644 --- a/syntax/vimwiki.vim +++ b/syntax/vimwiki.vim @@ -572,8 +572,8 @@ call vimwiki#u#reload_regexes_custom() let b:current_syntax="vimwiki" " EMBEDDED syntax setup "{{{ -let s:nested = VimwikiGet('nested_syntaxes') -if VimwikiGet('automatic_nested_syntaxes') +let s:nested = vimwiki#vars#get_wikilocal('nested_syntaxes') +if vimwiki#vars#get_wikilocal('automatic_nested_syntaxes') let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), "keep") endif if !empty(s:nested)