parent
f497a4abc7
commit
2329d602a7
@ -324,10 +324,10 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{
|
|||||||
if vimwiki#path#is_link_to_dir(link_text)
|
if vimwiki#path#is_link_to_dir(link_text)
|
||||||
if vimwiki#vars#get_global('dir_link') != ''
|
if vimwiki#vars#get_global('dir_link') != ''
|
||||||
let link_infos.filename .= 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
|
endif
|
||||||
else
|
else
|
||||||
let link_infos.filename .= VimwikiGet('ext', link_infos.index)
|
let link_infos.filename .= vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
elseif link_infos.scheme ==# 'diary'
|
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('path', link_infos.index) .
|
||||||
\ vimwiki#vars#get_wikilocal('diary_rel_path', link_infos.index) .
|
\ vimwiki#vars#get_wikilocal('diary_rel_path', link_infos.index) .
|
||||||
\ link_text .
|
\ link_text .
|
||||||
\ VimwikiGet('ext', link_infos.index)
|
\ vimwiki#vars#get_wikilocal('ext', link_infos.index)
|
||||||
elseif (link_infos.scheme ==# 'file' || link_infos.scheme ==# 'local')
|
elseif (link_infos.scheme ==# 'file' || link_infos.scheme ==# 'local')
|
||||||
\ && is_relative
|
\ && is_relative
|
||||||
let link_infos.filename = simplify(root_dir . link_text)
|
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()
|
let orig_pwd = getcwd()
|
||||||
lcd! %:h
|
lcd! %:h
|
||||||
" all path are relative to the current file's location
|
" 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
|
" 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
|
" restore the original working directory
|
||||||
exe 'lcd! '.orig_pwd
|
exe 'lcd! '.orig_pwd
|
||||||
" convert to a List
|
" convert to a List
|
||||||
@ -481,7 +481,7 @@ function! vimwiki#base#goto(...) "{{{
|
|||||||
let anchor = a:0 > 1 ? a:2 : ''
|
let anchor = a:0 > 1 ? a:2 : ''
|
||||||
|
|
||||||
call vimwiki#base#edit_file(':e',
|
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)
|
\ anchor)
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
@ -526,7 +526,7 @@ function! vimwiki#base#find_files(wiki_nr, directories_only)
|
|||||||
if a:directories_only
|
if a:directories_only
|
||||||
let ext = '/'
|
let ext = '/'
|
||||||
else
|
else
|
||||||
let ext = VimwikiGet('ext', wiki_nr)
|
let ext = vimwiki#vars#get_wikilocal('ext', wiki_nr)
|
||||||
endif
|
endif
|
||||||
" if current wiki is temporary -- was added by an arbitrary wiki file then do
|
" 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
|
" 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
|
" mark every index file as reachable
|
||||||
for idx in range(len(g:vimwiki_list))
|
for idx in range(len(g:vimwiki_list))
|
||||||
let index_file = vimwiki#vars#get_wikilocal('path', idx) . VimwikiGet('index', idx) .
|
let index_file = vimwiki#vars#get_wikilocal('path', idx) . vimwiki#vars#get_wikilocal('index', idx) .
|
||||||
\ VimwikiGet('ext', idx)
|
\ vimwiki#vars#get_wikilocal('ext', idx)
|
||||||
if filereadable(index_file)
|
if filereadable(index_file)
|
||||||
let reachable_wikifiles[index_file] = 1
|
let reachable_wikifiles[index_file] = 1
|
||||||
endif
|
endif
|
||||||
@ -976,7 +976,7 @@ function! s:update_wiki_links_dir(dir, old_fname, new_fname) " {{{
|
|||||||
let old_fname_r = vimwiki#base#apply_template(
|
let old_fname_r = vimwiki#base#apply_template(
|
||||||
\ g:vimwiki_WikiLinkMatchUrlTemplate, old_fname, '', '')
|
\ 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
|
for fname in files
|
||||||
call s:update_wiki_link(fname, old_fname_r, new_fname)
|
call s:update_wiki_link(fname, old_fname_r, new_fname)
|
||||||
endfor
|
endfor
|
||||||
@ -1030,7 +1030,7 @@ function! s:get_wiki_buffers() "{{{
|
|||||||
while bcount<=bufnr("$")
|
while bcount<=bufnr("$")
|
||||||
if bufexists(bcount)
|
if bufexists(bcount)
|
||||||
let bname = fnamemodify(bufname(bcount), ":p")
|
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")]
|
let bitem = [bname, getbufvar(bname, "vimwiki_prev_link")]
|
||||||
call add(blist, bitem)
|
call add(blist, bitem)
|
||||||
endif
|
endif
|
||||||
@ -1309,8 +1309,8 @@ function! vimwiki#base#goto_index(wnum, ...) "{{{
|
|||||||
|
|
||||||
call Validate_wiki_options(idx)
|
call Validate_wiki_options(idx)
|
||||||
call vimwiki#base#edit_file(cmd,
|
call vimwiki#base#edit_file(cmd,
|
||||||
\ vimwiki#vars#get_wikilocal('path', idx).VimwikiGet('index', idx).
|
\ vimwiki#vars#get_wikilocal('path', idx).vimwiki#vars#get_wikilocal('index', idx).
|
||||||
\ VimwikiGet('ext', idx),
|
\ vimwiki#vars#get_wikilocal('ext', idx),
|
||||||
\ '')
|
\ '')
|
||||||
call vimwiki#base#setup_buffer_state(idx)
|
call vimwiki#base#setup_buffer_state(idx)
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
@ -1378,7 +1378,7 @@ function! vimwiki#base#rename_link() "{{{
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let new_link = subdir.new_link
|
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
|
" do not rename if file with such name exists
|
||||||
let fname = glob(new_fname)
|
let fname = glob(new_fname)
|
||||||
@ -1886,7 +1886,7 @@ endfunction " }}}
|
|||||||
|
|
||||||
" s:normalize_link_in_diary
|
" s:normalize_link_in_diary
|
||||||
function! s:normalize_link_in_diary(lnk) " {{{
|
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_wiki = vimwiki#vars#get_wikilocal('path') . '/' . link
|
||||||
let link_diary = vimwiki#vars#get_wikilocal('path') . '/'
|
let link_diary = vimwiki#vars#get_wikilocal('path') . '/'
|
||||||
\ . vimwiki#vars#get_wikilocal('diary_rel_path') . '/' . link
|
\ . vimwiki#vars#get_wikilocal('diary_rel_path') . '/' . link
|
||||||
|
@ -27,7 +27,7 @@ endfunction "}}}
|
|||||||
|
|
||||||
function! s:diary_index(...) "{{{
|
function! s:diary_index(...) "{{{
|
||||||
let idx = a:0 == 0 ? g:vimwiki_current_idx : a:1
|
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 "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! vimwiki#diary#diary_date_link(...) "{{{
|
function! vimwiki#diary#diary_date_link(...) "{{{
|
||||||
@ -84,7 +84,7 @@ endfun "}}}
|
|||||||
|
|
||||||
fun! s:get_diary_links() "{{{
|
fun! s:get_diary_links() "{{{
|
||||||
let rx = '^\d\{4}-\d\d-\d\d'
|
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')
|
let files = split(s_files, '\n')
|
||||||
call filter(files, 'fnamemodify(v:val, ":t") =~# "'.escape(rx, '\').'"')
|
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 day = s:prefix_zero(a:day)
|
||||||
let month = s:prefix_zero(a:month)
|
let month = s:prefix_zero(a:month)
|
||||||
let sfile = vimwiki#vars#get_wikilocal('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')
|
\ a:year.'-'.month.'-'.day.vimwiki#vars#get_wikilocal('ext')
|
||||||
return filereadable(expand(sfile))
|
return filereadable(expand(sfile))
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ function! s:delete_html_files(path) "{{{
|
|||||||
" delete if there is no corresponding wiki file
|
" delete if there is no corresponding wiki file
|
||||||
let subdir = vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path_html'), fname)
|
let subdir = vimwiki#base#subdir(vimwiki#vars#get_wikilocal('path_html'), fname)
|
||||||
let wikifile = vimwiki#vars#get_wikilocal('path').subdir.
|
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)
|
if filereadable(wikifile)
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
@ -1357,7 +1357,7 @@ function! vimwiki#html#CustomWiki2HTML(path, wikifile, force) "{{{
|
|||||||
echomsg system(vimwiki#vars#get_wikilocal('custom_wiki2html'). ' '.
|
echomsg system(vimwiki#vars#get_wikilocal('custom_wiki2html'). ' '.
|
||||||
\ a:force. ' '.
|
\ a:force. ' '.
|
||||||
\ VimwikiGet('syntax'). ' '.
|
\ VimwikiGet('syntax'). ' '.
|
||||||
\ strpart(VimwikiGet('ext'), 1). ' '.
|
\ strpart(vimwiki#vars#get_wikilocal('ext'), 1). ' '.
|
||||||
\ shellescape(a:path). ' '.
|
\ shellescape(a:path). ' '.
|
||||||
\ shellescape(a:wikifile). ' '.
|
\ shellescape(a:wikifile). ' '.
|
||||||
\ shellescape(s:default_CSS_full_name(a:path)). ' '.
|
\ 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_subdir = VimwikiGet('subdir')
|
||||||
let current_invsubdir = VimwikiGet('invsubdir')
|
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
|
for wikifile in wikifiles
|
||||||
let wikifile = fnamemodify(wikifile, ":p")
|
let wikifile = fnamemodify(wikifile, ":p")
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at curso
|
|||||||
if !VimwikiLinkHandler(lnk)
|
if !VimwikiLinkHandler(lnk)
|
||||||
if !vimwiki#markdown_base#open_reflink(lnk)
|
if !vimwiki#markdown_base#open_reflink(lnk)
|
||||||
" remove the extension from the filename if exists
|
" 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)
|
call vimwiki#base#open_link(cmd, lnk)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -261,7 +261,7 @@ function! s:write_tags_metadata(metadata) "{{{
|
|||||||
let entry_data = substitute(entry_data, "\n", '\\n', 'g')
|
let entry_data = substitute(entry_data, "\n", '\\n', 'g')
|
||||||
call add(tags,
|
call add(tags,
|
||||||
\ entry.tagname . "\t"
|
\ entry.tagname . "\t"
|
||||||
\ . pagename . VimwikiGet('ext') . "\t"
|
\ . pagename . vimwiki#vars#get_wikilocal('ext') . "\t"
|
||||||
\ . entry.lineno
|
\ . entry.lineno
|
||||||
\ . ';"'
|
\ . ';"'
|
||||||
\ . "\t" . "vimwiki:" . entry_data
|
\ . "\t" . "vimwiki:" . entry_data
|
||||||
|
@ -27,7 +27,7 @@ if vimwiki#vars#get_global('conceallevel') && exists("+conceallevel")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" GOTO FILE: gf {{{
|
" GOTO FILE: gf {{{
|
||||||
execute 'setlocal suffixesadd='.VimwikiGet('ext')
|
execute 'setlocal suffixesadd='.vimwiki#vars#get_wikilocal('ext')
|
||||||
setlocal isfname-=[,]
|
setlocal isfname-=[,]
|
||||||
" gf}}}
|
" gf}}}
|
||||||
|
|
||||||
@ -279,10 +279,10 @@ command! -buffer -nargs=0 VimwikiBacklinks call vimwiki#base#backlinks()
|
|||||||
command! -buffer -nargs=0 VWB call vimwiki#base#backlinks()
|
command! -buffer -nargs=0 VWB call vimwiki#base#backlinks()
|
||||||
|
|
||||||
exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep <args> '.
|
exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep <args> '.
|
||||||
\ 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 <args> '.
|
exe 'command! -buffer -nargs=* VWS lvimgrep <args> '.
|
||||||
\ 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
|
command! -buffer -nargs=+ -complete=custom,vimwiki#base#complete_links_escaped
|
||||||
\ VimwikiGoto call vimwiki#base#goto(<f-args>)
|
\ VimwikiGoto call vimwiki#base#goto(<f-args>)
|
||||||
|
@ -274,12 +274,9 @@ endfunction "}}}
|
|||||||
function! s:vimwiki_get_known_extensions() " {{{
|
function! s:vimwiki_get_known_extensions() " {{{
|
||||||
" Getting all extensions that different wikis could have
|
" Getting all extensions that different wikis could have
|
||||||
let extensions = {}
|
let extensions = {}
|
||||||
for wiki in g:vimwiki_list
|
for idx in range(vimwiki#vars#number_of_wikis())
|
||||||
if has_key(wiki, 'ext')
|
let ext = vimwiki#vars#get_wikilocal('ext', idx)
|
||||||
let extensions[wiki.ext] = 1
|
let extensions[ext] = 1
|
||||||
else
|
|
||||||
let extensions['.wiki'] = 1
|
|
||||||
endif
|
|
||||||
endfor
|
endfor
|
||||||
" append extensions from g:vimwiki_ext2syntax
|
" append extensions from g:vimwiki_ext2syntax
|
||||||
for ext in keys(vimwiki#vars#get_global('ext2syntax'))
|
for ext in keys(vimwiki#vars#get_global('ext2syntax'))
|
||||||
@ -320,8 +317,6 @@ endif "}}}
|
|||||||
|
|
||||||
" DEFAULT wiki {{{
|
" DEFAULT wiki {{{
|
||||||
let s:vimwiki_defaults = {}
|
let s:vimwiki_defaults = {}
|
||||||
let s:vimwiki_defaults.index = 'index'
|
|
||||||
let s:vimwiki_defaults.ext = '.wiki'
|
|
||||||
let s:vimwiki_defaults.syntax = 'default'
|
let s:vimwiki_defaults.syntax = 'default'
|
||||||
|
|
||||||
" is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki
|
" is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki
|
||||||
|
Loading…
Reference in New Issue
Block a user