diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 513a0b1..783ace8 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -132,7 +132,7 @@ function! vimwiki#base#setup_buffer_state(idx) " {{{ Init page-specific variable call VimwikiSet('invsubdir', vimwiki#base#invsubdir(subdir), a:idx) if vimwiki#vars#get_global('auto_chdir') == 1 - exe 'lcd' VimwikiGet('path') + exe 'lcd' vimwiki#vars#get_wikilocal('path') endif " update cache @@ -209,7 +209,7 @@ endfunction "}}} " vimwiki#base#current_subdir function! vimwiki#base#current_subdir(idx)"{{{ - return vimwiki#base#subdir(VimwikiGet('path', a:idx), expand('%:p')) + return vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path', a:idx), expand('%:p')) endfunction"}}} " vimwiki#base#invsubdir @@ -223,7 +223,7 @@ function! vimwiki#base#find_wiki(path) "{{{ let path = vimwiki#path#path_norm(vimwiki#path#chomp_slash(a:path)) let idx = 0 while idx < len(g:vimwiki_list) - let idx_path = expand(VimwikiGet('path', idx)) + let idx_path = expand(vimwiki#vars#get_wikilocal('path', idx)) let idx_path = vimwiki#path#path_norm(vimwiki#path#chomp_slash(idx_path)) if vimwiki#path#is_equal( \ vimwiki#path#path_common_pfx(idx_path, path), idx_path) @@ -316,7 +316,7 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{ endif if !is_relative || link_infos.index != source_wiki - let root_dir = VimwikiGet('path', link_infos.index) + let root_dir = vimwiki#vars#get_wikilocal('path', link_infos.index) endif let link_infos.filename = root_dir . link_text @@ -334,7 +334,7 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{ let link_infos.index = source_wiki let link_infos.filename = - \ VimwikiGet('path', link_infos.index) . + \ vimwiki#vars#get_wikilocal('path', link_infos.index) . \ vimwiki#vars#get_wikilocal('diary_rel_path', link_infos.index) . \ link_text . \ VimwikiGet('ext', link_infos.index) @@ -481,7 +481,7 @@ function! vimwiki#base#goto(...) "{{{ let anchor = a:0 > 1 ? a:2 : '' call vimwiki#base#edit_file(':e', - \ VimwikiGet('path') . key . VimwikiGet('ext'), + \ vimwiki#vars#get_wikilocal('path') . key . VimwikiGet('ext'), \ anchor) endfunction "}}} @@ -518,9 +518,9 @@ endfunction "}}} function! vimwiki#base#find_files(wiki_nr, directories_only) let wiki_nr = a:wiki_nr if wiki_nr >= 0 - let root_directory = VimwikiGet('path', wiki_nr) + let root_directory = vimwiki#vars#get_wikilocal('path', wiki_nr) else - let root_directory = VimwikiGet('path').vimwiki#vars#get_wikilocal('diary_rel_path') + let root_directory = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path') let wiki_nr = g:vimwiki_current_idx endif if a:directories_only @@ -548,9 +548,9 @@ function! vimwiki#base#get_wikilinks(wiki_nr, also_absolute_links) if a:wiki_nr == g:vimwiki_current_idx let cwd = vimwiki#path#wikify_path(expand('%:p:h')) elseif a:wiki_nr < 0 - let cwd = VimwikiGet('path').vimwiki#vars#get_wikilocal('diary_rel_path') + let cwd = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path') else - let cwd = VimwikiGet('path', a:wiki_nr) + let cwd = vimwiki#vars#get_wikilocal('path', a:wiki_nr) endif let result = [] for wikifile in files @@ -561,9 +561,9 @@ function! vimwiki#base#get_wikilinks(wiki_nr, also_absolute_links) if a:also_absolute_links for wikifile in files if a:wiki_nr == g:vimwiki_current_idx - let cwd = VimwikiGet('path') + let cwd = vimwiki#vars#get_wikilocal('path') elseif a:wiki_nr < 0 - let cwd = VimwikiGet('path').vimwiki#vars#get_wikilocal('diary_rel_path') + let cwd = vimwiki#vars#get_wikilocal('path') . vimwiki#vars#get_wikilocal('diary_rel_path') endif let wikifile = fnamemodify(wikifile, ':r') " strip extension let wikifile = '/'.vimwiki#path#relpath(cwd, wikifile) @@ -578,9 +578,9 @@ function! vimwiki#base#get_wiki_directories(wiki_nr) let dirs = vimwiki#base#find_files(a:wiki_nr, 1) if a:wiki_nr == g:vimwiki_current_idx let cwd = vimwiki#path#wikify_path(expand('%:p:h')) - let root_dir = VimwikiGet('path') + let root_dir = vimwiki#vars#get_wikilocal('path') else - let cwd = VimwikiGet('path', a:wiki_nr) + let cwd = vimwiki#vars#get_wikilocal('path', a:wiki_nr) endif let result = ['./'] for wikidir in dirs @@ -790,7 +790,7 @@ function! vimwiki#base#check_links() "{{{ " mark every index file as reachable for idx in range(len(g:vimwiki_list)) - let index_file = VimwikiGet('path', idx) . VimwikiGet('index', idx) . + let index_file = vimwiki#vars#get_wikilocal('path', idx) . VimwikiGet('index', idx) . \ VimwikiGet('ext', idx) if filereadable(index_file) let reachable_wikifiles[index_file] = 1 @@ -942,7 +942,7 @@ function! s:print_wiki_list() "{{{ let sep = ' ' echohl None endif - echo (idx + 1).sep.VimwikiGet('path', idx) + echo (idx + 1) . sep . vimwiki#vars#get_wikilocal('path', idx) let idx += 1 endwhile echohl None @@ -976,7 +976,7 @@ function! s:update_wiki_links_dir(dir, old_fname, new_fname) " {{{ let old_fname_r = vimwiki#base#apply_template( \ g:vimwiki_WikiLinkMatchUrlTemplate, old_fname, '', '') - let files = split(glob(VimwikiGet('path').a:dir.'*'.VimwikiGet('ext')), '\n') + let files = split(glob(vimwiki#vars#get_wikilocal('path').a:dir.'*'.VimwikiGet('ext')), '\n') for fname in files call s:update_wiki_link(fname, old_fname_r, new_fname) endfor @@ -1309,7 +1309,7 @@ function! vimwiki#base#goto_index(wnum, ...) "{{{ call Validate_wiki_options(idx) call vimwiki#base#edit_file(cmd, - \ VimwikiGet('path', idx).VimwikiGet('index', idx). + \ vimwiki#vars#get_wikilocal('path', idx).VimwikiGet('index', idx). \ VimwikiGet('ext', idx), \ '') call vimwiki#base#setup_buffer_state(idx) @@ -1378,7 +1378,7 @@ function! vimwiki#base#rename_link() "{{{ endif let new_link = subdir.new_link - let new_fname = VimwikiGet('path').new_link.VimwikiGet('ext') + let new_fname = vimwiki#vars#get_wikilocal('path') . new_link . VimwikiGet('ext') " do not rename if file with such name exists let fname = glob(new_fname) @@ -1389,7 +1389,7 @@ function! vimwiki#base#rename_link() "{{{ endif " rename wiki link file try - echomsg 'Vimwiki: Renaming '.VimwikiGet('path').old_fname.' to '.new_fname + echomsg 'Vimwiki: Renaming '.vimwiki#vars#get_wikilocal('path').old_fname.' to '.new_fname let res = rename(expand('%:p'), expand(new_fname)) if res != 0 throw "Cannot rename!" @@ -1857,7 +1857,7 @@ endfunction " }}} function! s:is_diary_file(filename) " {{{ let file_path = vimwiki#path#path_norm(a:filename) let rel_path = vimwiki#vars#get_wikilocal('diary_rel_path') - let diary_path = vimwiki#path#path_norm(VimwikiGet('path') . rel_path) + let diary_path = vimwiki#path#path_norm(vimwiki#vars#get_wikilocal('path') . rel_path) return rel_path != '' \ && file_path =~# '^'.vimwiki#u#escape(diary_path) endfunction " }}} @@ -1887,8 +1887,8 @@ endfunction " }}} " s:normalize_link_in_diary function! s:normalize_link_in_diary(lnk) " {{{ let link = a:lnk . VimwikiGet('ext') - let link_wiki = VimwikiGet('path') . '/' . link - let link_diary = VimwikiGet('path') . '/' + let link_wiki = vimwiki#vars#get_wikilocal('path') . '/' . link + let link_diary = vimwiki#vars#get_wikilocal('path') . '/' \ . vimwiki#vars#get_wikilocal('diary_rel_path') . '/' . link let link_exists_in_diary = filereadable(link_diary) let link_exists_in_wiki = filereadable(link_wiki) diff --git a/autoload/vimwiki/diary.vim b/autoload/vimwiki/diary.vim index 0fecbe1..744f41c 100644 --- a/autoload/vimwiki/diary.vim +++ b/autoload/vimwiki/diary.vim @@ -22,7 +22,7 @@ endfunction "}}} function! s:diary_path(...) "{{{ let idx = a:0 == 0 ? g:vimwiki_current_idx : a:1 - return VimwikiGet('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx) + return vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx) endfunction "}}} function! s:diary_index(...) "{{{ @@ -84,7 +84,7 @@ endfun "}}} fun! s:get_diary_links() "{{{ let rx = '^\d\{4}-\d\d-\d\d' - let s_files = glob(VimwikiGet('path').vimwiki#vars#get_wikilocal('diary_rel_path').'*'.VimwikiGet('ext')) + let s_files = glob(vimwiki#vars#get_wikilocal('path').vimwiki#vars#get_wikilocal('diary_rel_path').'*'.VimwikiGet('ext')) let files = split(s_files, '\n') call filter(files, 'fnamemodify(v:val, ":t") =~# "'.escape(rx, '\').'"') @@ -171,7 +171,7 @@ function! vimwiki#diary#make_note(wnum, ...) "{{{ let idx = 0 endif - call vimwiki#path#mkdir(VimwikiGet('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx)) + call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('diary_rel_path', idx)) if a:0 && a:1 == 1 let cmd = 'tabedit' @@ -285,7 +285,7 @@ endfunction "}}} function vimwiki#diary#calendar_sign(day, month, year) "{{{ let day = s:prefix_zero(a:day) let month = s:prefix_zero(a:month) - let sfile = VimwikiGet('path').vimwiki#vars#get_wikilocal('diary_rel_path'). + let sfile = vimwiki#vars#get_wikilocal('path').vimwiki#vars#get_wikilocal('diary_rel_path'). \ a:year.'-'.month.'-'.day.VimwikiGet('ext') return filereadable(expand(sfile)) endfunction "}}} diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim index b6310b7..5c466ec 100644 --- a/autoload/vimwiki/html.vim +++ b/autoload/vimwiki/html.vim @@ -68,7 +68,7 @@ endfunction " }}} function! s:default_CSS_full_name(path) " {{{ let path = expand(a:path) - let css_full_name = path.VimwikiGet('css_name') + let css_full_name = path . vimwiki#vars#get_wikilocal('css_name') return css_full_name endfunction "}}} @@ -162,8 +162,8 @@ function! s:delete_html_files(path) "{{{ endif " delete if there is no corresponding wiki file - let subdir = vimwiki#base#subdir(VimwikiGet('path_html'), fname) - let wikifile = VimwikiGet('path').subdir. + let subdir = vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path_html'), fname) + let wikifile = vimwiki#vars#get_wikilocal('path').subdir. \fnamemodify(fname, ":t:r").VimwikiGet('ext') if filereadable(wikifile) continue @@ -231,7 +231,7 @@ function! s:is_html_uptodate(wikifile) "{{{ endif let wikifile = fnamemodify(a:wikifile, ":p") - let htmlfile = expand(VimwikiGet('path_html').VimwikiGet('subdir'). + let htmlfile = expand(vimwiki#vars#get_wikilocal('path_html') . VimwikiGet('subdir') . \fnamemodify(wikifile, ":t:r").".html") if getftime(wikifile) <= getftime(htmlfile) && tpl_time <= getftime(htmlfile) @@ -1483,7 +1483,7 @@ function! s:convert_file(path_html, wikifile) "{{{ call map(html_lines, 'substitute(v:val, "%root_path%", "'. \ s:root_path(VimwikiGet('subdir')) .'", "g")') - let css_name = expand(VimwikiGet('css_name')) + let css_name = expand(vimwiki#vars#get_wikilocal('css_name')) let css_name = substitute(css_name, '\', '/', 'g') call map(html_lines, 'substitute(v:val, "%css%", "'. css_name .'", "g")') @@ -1544,12 +1544,12 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{ let current_subdir = VimwikiGet('subdir') let current_invsubdir = VimwikiGet('invsubdir') - let wikifiles = split(glob(VimwikiGet('path').'**/*'.VimwikiGet('ext')), '\n') + let wikifiles = split(glob(vimwiki#vars#get_wikilocal('path').'**/*'.VimwikiGet('ext')), '\n') for wikifile in wikifiles let wikifile = fnamemodify(wikifile, ":p") " temporarily adjust 'subdir' and 'invsubdir' state variables - let subdir = vimwiki#base#subdir(VimwikiGet('path'), wikifile) + let subdir = vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path'), wikifile) call VimwikiSet('subdir', subdir) call VimwikiSet('invsubdir', vimwiki#base#invsubdir(subdir)) @@ -1583,10 +1583,9 @@ function! s:binary_exists(fname) "{{{ return executable(expand(a:fname)) endfunction "}}} -" uses VimwikiGet('path') function! s:get_wikifile_url(wikifile) "{{{ - return VimwikiGet('path_html'). - \ vimwiki#base#subdir(VimwikiGet('path'), a:wikifile). + return vimwiki#vars#get_wikilocal('path_html') . + \ vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path'), a:wikifile). \ fnamemodify(a:wikifile, ":t:r").'.html' endfunction "}}} diff --git a/autoload/vimwiki/tags.vim b/autoload/vimwiki/tags.vim index 9585641..d0fa45d 100644 --- a/autoload/vimwiki/tags.vim +++ b/autoload/vimwiki/tags.vim @@ -41,7 +41,7 @@ function! vimwiki#tags#update_tags(full_rebuild, all_files) "{{{ call s:write_tags_metadata(metadata) else " full rebuild let files = vimwiki#base#find_files(g:vimwiki_current_idx, 0) - let wiki_base_dir = VimwikiGet('path', g:vimwiki_current_idx) + let wiki_base_dir = vimwiki#vars#get_wikilocal('path', g:vimwiki_current_idx) let tags_file_last_modification = \ getftime(vimwiki#tags#metadata_file_path()) let metadata = s:load_tags_metadata() @@ -141,7 +141,7 @@ endfunction " }}} " vimwiki#tags#metadata_file_path " Returns tags metadata file path function! vimwiki#tags#metadata_file_path() abort "{{{ - return fnamemodify(vimwiki#path#join_path(VimwikiGet('path'), s:TAGS_METADATA_FILE_NAME), ':p') + return fnamemodify(vimwiki#path#join_path(vimwiki#vars#get_wikilocal('path'), s:TAGS_METADATA_FILE_NAME), ':p') endfunction " }}} " s:load_tags_metadata diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 1308a63..ab9118c 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -245,18 +245,18 @@ endfunction "}}} command! -buffer Vimwiki2HTML \ if filewritable(expand('%')) | silent noautocmd w | endif \ - \ let res = vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')), + \ let res = vimwiki#html#Wiki2HTML(expand(vimwiki#vars#get_wikilocal('path_html')), \ expand('%')) \ - \ if res != '' | echo 'Vimwiki: HTML conversion is done, output: '.expand(VimwikiGet('path_html')) | endif + \ if res != '' | echo 'Vimwiki: HTML conversion is done, output: ' . expand(vimwiki#vars#get_wikilocal('path_html')) | endif command! -buffer Vimwiki2HTMLBrowse \ if filewritable(expand('%')) | silent noautocmd w | endif \ \ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML( - \ expand(VimwikiGet('path_html')), + \ expand(vimwiki#vars#get_wikilocal('path_html')), \ expand('%'))) command! -buffer VimwikiAll2HTML - \ call vimwiki#html#WikiAll2HTML(expand(VimwikiGet('path_html'))) + \ call vimwiki#html#WikiAll2HTML(expand(vimwiki#vars#get_wikilocal('path_html'))) command! -buffer VimwikiTOC call vimwiki#base#table_of_contents(1) @@ -279,10 +279,10 @@ command! -buffer -nargs=0 VimwikiBacklinks call vimwiki#base#backlinks() command! -buffer -nargs=0 VWB call vimwiki#base#backlinks() exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep '. - \ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ') + \ escape(vimwiki#vars#get_wikilocal('path').'**/*'.VimwikiGet('ext'), ' ') exe 'command! -buffer -nargs=* VWS lvimgrep '. - \ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ') + \ escape(vimwiki#vars#get_wikilocal('path').'**/*'.VimwikiGet('ext'), ' ') command! -buffer -nargs=+ -complete=custom,vimwiki#base#complete_links_escaped \ VimwikiGoto call vimwiki#base#goto() @@ -643,7 +643,7 @@ if vimwiki#vars#get_wikilocal('auto_export') " Automatically generate HTML on page write. augroup vimwiki au BufWritePost - \ call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')), + \ call vimwiki#html#Wiki2HTML(expand(vimwiki#vars#get_wikilocal('path_html')), \ expand('%')) augroup END endif diff --git a/plugin/vimwiki.vim b/plugin/vimwiki.vim index 9aa8d80..3e65cbd 100644 --- a/plugin/vimwiki.vim +++ b/plugin/vimwiki.vim @@ -20,11 +20,11 @@ function! s:default(varname, value) "{{{ endfunction "}}} function! s:path_html(idx) "{{{ - let path_html = VimwikiGet('path_html', a:idx) + let path_html = vimwiki#vars#get_wikilocal('path_html', a:idx) if !empty(path_html) return path_html else - let path = VimwikiGet('path', a:idx) + let path = vimwiki#vars#get_wikilocal('path', a:idx) return substitute(path, '[/\\]\+$', '', '').'_html/' endif endfunction "}}} @@ -40,8 +40,8 @@ function! s:normalize_path(path) "{{{ 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 vimwiki#vars#set_wikilocal('path', s:normalize_path(vimwiki#vars#get_wikilocal('path', a:idx)), a:idx) + call vimwiki#vars#set_wikilocal('path_html', s:normalize_path(s:path_html(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', @@ -139,7 +139,7 @@ function! s:setup_buffer_enter() "{{{ " to force a rescan of the filesystem which may have changed " and update VimwikiLinks syntax group that depends on it; " b:vimwiki_fs_rescan indicates that setup_filetype() has not been run - if exists("b:vimwiki_fs_rescan") && VimwikiGet('maxhi') + if exists("b:vimwiki_fs_rescan") && vimwiki#vars#get_wikilocal('maxhi') set syntax=vimwiki endif let b:vimwiki_fs_rescan = 1 @@ -320,12 +320,8 @@ endif "}}} " DEFAULT wiki {{{ let s:vimwiki_defaults = {} -let s:vimwiki_defaults.path = '~/vimwiki/' -let s:vimwiki_defaults.path_html = '' " '' is replaced by derived path.'_html/' -let s:vimwiki_defaults.css_name = 'style.css' let s:vimwiki_defaults.index = 'index' let s:vimwiki_defaults.ext = '.wiki' -let s:vimwiki_defaults.maxhi = 0 let s:vimwiki_defaults.syntax = 'default' " is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki @@ -439,7 +435,7 @@ nnoremap