diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 783ace8..02b7b61 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -324,10 +324,10 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{ if vimwiki#path#is_link_to_dir(link_text) if vimwiki#vars#get_global('dir_link') != '' let link_infos.filename .= vimwiki#vars#get_global('dir_link') . - \ VimwikiGet('ext', link_infos.index) + \ vimwiki#vars#get_wikilocal('ext', link_infos.index) endif else - let link_infos.filename .= VimwikiGet('ext', link_infos.index) + let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index) endif elseif link_infos.scheme ==# 'diary' @@ -337,7 +337,7 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{ \ 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) + \ vimwiki#vars#get_wikilocal('ext', link_infos.index) elseif (link_infos.scheme ==# 'file' || link_infos.scheme ==# 'local') \ && is_relative let link_infos.filename = simplify(root_dir . link_text) @@ -437,9 +437,9 @@ function! vimwiki#base#get_globlinks_escaped() abort "{{{only get links from the let orig_pwd = getcwd() lcd! %:h " all path are relative to the current file's location - let globlinks = glob('*'.VimwikiGet('ext'),1)."\n" + let globlinks = glob('*'.vimwiki#vars#get_wikilocal('ext'), 1)."\n" " remove extensions - let globlinks = substitute(globlinks, '\'.VimwikiGet('ext').'\ze\n', '', 'g') + let globlinks = substitute(globlinks, '\'.vimwiki#vars#get_wikilocal('ext').'\ze\n', '', 'g') " restore the original working directory exe 'lcd! '.orig_pwd " convert to a List @@ -481,7 +481,7 @@ function! vimwiki#base#goto(...) "{{{ let anchor = a:0 > 1 ? a:2 : '' call vimwiki#base#edit_file(':e', - \ vimwiki#vars#get_wikilocal('path') . key . VimwikiGet('ext'), + \ vimwiki#vars#get_wikilocal('path') . key . vimwiki#vars#get_wikilocal('ext'), \ anchor) endfunction "}}} @@ -526,7 +526,7 @@ function! vimwiki#base#find_files(wiki_nr, directories_only) if a:directories_only let ext = '/' else - let ext = VimwikiGet('ext', wiki_nr) + let ext = vimwiki#vars#get_wikilocal('ext', wiki_nr) endif " 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 @@ -790,8 +790,8 @@ function! vimwiki#base#check_links() "{{{ " mark every index file as reachable for idx in range(len(g:vimwiki_list)) - let index_file = vimwiki#vars#get_wikilocal('path', idx) . VimwikiGet('index', idx) . - \ VimwikiGet('ext', idx) + let index_file = vimwiki#vars#get_wikilocal('path', idx) . vimwiki#vars#get_wikilocal('index', idx) . + \ vimwiki#vars#get_wikilocal('ext', idx) if filereadable(index_file) let reachable_wikifiles[index_file] = 1 endif @@ -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(vimwiki#vars#get_wikilocal('path').a:dir.'*'.VimwikiGet('ext')), '\n') + let files = split(glob(vimwiki#vars#get_wikilocal('path').a:dir.'*'.vimwiki#vars#get_wikilocal('ext')), '\n') for fname in files call s:update_wiki_link(fname, old_fname_r, new_fname) endfor @@ -1030,7 +1030,7 @@ function! s:get_wiki_buffers() "{{{ while bcount<=bufnr("$") if bufexists(bcount) let bname = fnamemodify(bufname(bcount), ":p") - if bname =~# VimwikiGet('ext')."$" + if bname =~# vimwiki#vars#get_wikilocal('ext')."$" let bitem = [bname, getbufvar(bname, "vimwiki_prev_link")] call add(blist, bitem) endif @@ -1309,8 +1309,8 @@ function! vimwiki#base#goto_index(wnum, ...) "{{{ call Validate_wiki_options(idx) call vimwiki#base#edit_file(cmd, - \ vimwiki#vars#get_wikilocal('path', idx).VimwikiGet('index', idx). - \ VimwikiGet('ext', idx), + \ vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('index', idx). + \ vimwiki#vars#get_wikilocal('ext', idx), \ '') call vimwiki#base#setup_buffer_state(idx) endfunction "}}} @@ -1378,7 +1378,7 @@ function! vimwiki#base#rename_link() "{{{ endif let new_link = subdir.new_link - let new_fname = vimwiki#vars#get_wikilocal('path') . new_link . VimwikiGet('ext') + let new_fname = vimwiki#vars#get_wikilocal('path') . new_link . vimwiki#vars#get_wikilocal('ext') " do not rename if file with such name exists let fname = glob(new_fname) @@ -1886,7 +1886,7 @@ endfunction " }}} " s:normalize_link_in_diary function! s:normalize_link_in_diary(lnk) " {{{ - let link = a:lnk . VimwikiGet('ext') + let link = a:lnk . vimwiki#vars#get_wikilocal('ext') 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 diff --git a/autoload/vimwiki/diary.vim b/autoload/vimwiki/diary.vim index 744f41c..609dbf3 100644 --- a/autoload/vimwiki/diary.vim +++ b/autoload/vimwiki/diary.vim @@ -27,7 +27,7 @@ endfunction "}}} function! s:diary_index(...) "{{{ let idx = a:0 == 0 ? g:vimwiki_current_idx : a:1 - return s:diary_path(idx).vimwiki#vars#get_wikilocal('diary_index', idx).VimwikiGet('ext', idx) + return s:diary_path(idx).vimwiki#vars#get_wikilocal('diary_index', idx).vimwiki#vars#get_wikilocal('ext', idx) endfunction "}}} function! vimwiki#diary#diary_date_link(...) "{{{ @@ -84,7 +84,7 @@ endfun "}}} fun! s:get_diary_links() "{{{ let rx = '^\d\{4}-\d\d-\d\d' - let s_files = glob(vimwiki#vars#get_wikilocal('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').'*'.vimwiki#vars#get_wikilocal('ext')) let files = split(s_files, '\n') call filter(files, 'fnamemodify(v:val, ":t") =~# "'.escape(rx, '\').'"') @@ -286,7 +286,7 @@ function vimwiki#diary#calendar_sign(day, month, year) "{{{ let day = s:prefix_zero(a:day) let month = s:prefix_zero(a:month) let sfile = vimwiki#vars#get_wikilocal('path').vimwiki#vars#get_wikilocal('diary_rel_path'). - \ a:year.'-'.month.'-'.day.VimwikiGet('ext') + \ a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext') return filereadable(expand(sfile)) endfunction "}}} diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim index 5c466ec..109965e 100644 --- a/autoload/vimwiki/html.vim +++ b/autoload/vimwiki/html.vim @@ -164,7 +164,7 @@ function! s:delete_html_files(path) "{{{ " delete if there is no corresponding wiki file 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') + \fnamemodify(fname, ":t:r").vimwiki#vars#get_wikilocal('ext') if filereadable(wikifile) continue endif @@ -1357,7 +1357,7 @@ function! vimwiki#html#CustomWiki2HTML(path, wikifile, force) "{{{ echomsg system(vimwiki#vars#get_wikilocal('custom_wiki2html'). ' '. \ a:force. ' '. \ VimwikiGet('syntax'). ' '. - \ strpart(VimwikiGet('ext'), 1). ' '. + \ strpart(vimwiki#vars#get_wikilocal('ext'), 1). ' '. \ shellescape(a:path). ' '. \ shellescape(a:wikifile). ' '. \ shellescape(s:default_CSS_full_name(a:path)). ' '. @@ -1544,7 +1544,7 @@ function! vimwiki#html#WikiAll2HTML(path_html) "{{{ let current_subdir = VimwikiGet('subdir') let current_invsubdir = VimwikiGet('invsubdir') - let wikifiles = split(glob(vimwiki#vars#get_wikilocal('path').'**/*'.VimwikiGet('ext')), '\n') + let wikifiles = split(glob(vimwiki#vars#get_wikilocal('path').'**/*'.vimwiki#vars#get_wikilocal('ext')), '\n') for wikifile in wikifiles let wikifile = fnamemodify(wikifile, ":p") diff --git a/autoload/vimwiki/markdown_base.vim b/autoload/vimwiki/markdown_base.vim index ef2eb36..e35e8b0 100644 --- a/autoload/vimwiki/markdown_base.vim +++ b/autoload/vimwiki/markdown_base.vim @@ -109,7 +109,7 @@ function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at curso if !VimwikiLinkHandler(lnk) if !vimwiki#markdown_base#open_reflink(lnk) " remove the extension from the filename if exists - let lnk = substitute(lnk, VimwikiGet('ext').'$', '', '') + let lnk = substitute(lnk, vimwiki#vars#get_wikilocal('ext').'$', '', '') call vimwiki#base#open_link(cmd, lnk) endif endif diff --git a/autoload/vimwiki/tags.vim b/autoload/vimwiki/tags.vim index d0fa45d..311c111 100644 --- a/autoload/vimwiki/tags.vim +++ b/autoload/vimwiki/tags.vim @@ -261,7 +261,7 @@ function! s:write_tags_metadata(metadata) "{{{ let entry_data = substitute(entry_data, "\n", '\\n', 'g') call add(tags, \ entry.tagname . "\t" - \ . pagename . VimwikiGet('ext') . "\t" + \ . pagename . vimwiki#vars#get_wikilocal('ext') . "\t" \ . entry.lineno \ . ';"' \ . "\t" . "vimwiki:" . entry_data diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index ab9118c..970bb69 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -27,7 +27,7 @@ if vimwiki#vars#get_global('conceallevel') && exists("+conceallevel") endif " GOTO FILE: gf {{{ -execute 'setlocal suffixesadd='.VimwikiGet('ext') +execute 'setlocal suffixesadd='.vimwiki#vars#get_wikilocal('ext') setlocal isfname-=[,] " gf}}} @@ -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(vimwiki#vars#get_wikilocal('path').'**/*'.VimwikiGet('ext'), ' ') + \ escape(vimwiki#vars#get_wikilocal('path').'**/*'.vimwiki#vars#get_wikilocal('ext'), ' ') exe 'command! -buffer -nargs=* VWS lvimgrep '. - \ escape(vimwiki#vars#get_wikilocal('path').'**/*'.VimwikiGet('ext'), ' ') + \ escape(vimwiki#vars#get_wikilocal('path').'**/*'.vimwiki#vars#get_wikilocal('ext'), ' ') command! -buffer -nargs=+ -complete=custom,vimwiki#base#complete_links_escaped \ VimwikiGoto call vimwiki#base#goto() diff --git a/plugin/vimwiki.vim b/plugin/vimwiki.vim index 3e65cbd..26eb8dd 100644 --- a/plugin/vimwiki.vim +++ b/plugin/vimwiki.vim @@ -274,12 +274,9 @@ 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 + for idx in range(vimwiki#vars#number_of_wikis()) + let ext = vimwiki#vars#get_wikilocal('ext', idx) + let extensions[ext] = 1 endfor " append extensions from g:vimwiki_ext2syntax for ext in keys(vimwiki#vars#get_global('ext2syntax')) @@ -320,8 +317,6 @@ endif "}}} " DEFAULT wiki {{{ let s:vimwiki_defaults = {} -let s:vimwiki_defaults.index = 'index' -let s:vimwiki_defaults.ext = '.wiki' let s:vimwiki_defaults.syntax = 'default' " is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki