Change: VimwikiCheckLinks work on current wiki or on given range
Problem: VimwikiCheckLinks can be slow Solution: Work only on current wiki or accept a range
This commit is contained in:
parent
659ca62b29
commit
dede5a1eea
@ -955,11 +955,20 @@ endfunction
|
||||
|
||||
|
||||
" Check if all wikilinks are reachable. Answer in quickfix
|
||||
function! vimwiki#base#check_links() abort
|
||||
function! vimwiki#base#check_links(range, line1, line2) abort
|
||||
if a:range == 0
|
||||
let wiki_list = [vimwiki#vars#get_bufferlocal('wiki_nr')]
|
||||
elseif a:range == 1
|
||||
let wiki_list = [a:line1]
|
||||
else
|
||||
let wiki_list = range(a:line1, a:line2)
|
||||
endif
|
||||
echom 'Vimwiki Checking links in wikis ' . string(wiki_list)
|
||||
|
||||
let anchors_of_files = {}
|
||||
let links_of_files = {}
|
||||
let errors = []
|
||||
for idx in range(vimwiki#vars#number_of_wikis())
|
||||
for idx in wiki_list
|
||||
let syntax = vimwiki#vars#get_wikilocal('syntax', idx)
|
||||
let wikifiles = vimwiki#base#find_files(idx, 0)
|
||||
for wikifile in wikifiles
|
||||
@ -1013,7 +1022,7 @@ function! vimwiki#base#check_links() abort
|
||||
endfor
|
||||
|
||||
" Mark: every index file as reachable
|
||||
for idx in range(vimwiki#vars#number_of_wikis())
|
||||
for idx in wiki_list
|
||||
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)
|
||||
|
@ -929,6 +929,8 @@ Vimwiki file.
|
||||
and links to external files actually exist. Check also if all wiki files
|
||||
are reachable from the index file. The results are shown in the quickfix
|
||||
window.
|
||||
With range: the wiki number, by default current wiki
|
||||
|
||||
|
||||
*:VimwikiRebuildTags*
|
||||
Rebuilds the tags metadata file for all wiki files newer than the metadata
|
||||
@ -3761,6 +3763,7 @@ New:~
|
||||
* PR #934: RSS feed generation for diary with :VimwikiRss.
|
||||
|
||||
Changed:~
|
||||
* VimwikiCheckLinks work on current wiki or on range
|
||||
* |g:vimwiki_toc_link_format| == 0 (default) means old behavior: short links
|
||||
|
||||
Removed:~
|
||||
|
@ -295,7 +295,7 @@ command! -buffer -nargs=* VWS call vimwiki#base#search(<q-args>)
|
||||
command! -buffer -nargs=* -complete=customlist,vimwiki#base#complete_links_escaped
|
||||
\ VimwikiGoto call vimwiki#base#goto(<f-args>)
|
||||
|
||||
command! -buffer VimwikiCheckLinks call vimwiki#base#check_links()
|
||||
command! -buffer -range VimwikiCheckLinks call vimwiki#base#check_links(<range>, <line1>, <line2>)
|
||||
|
||||
" list commands
|
||||
command! -buffer -nargs=+ VimwikiReturn call <SID>CR(<f-args>)
|
||||
|
Loading…
Reference in New Issue
Block a user