commit b912e4e3c702f3ce617e54b846c13e1754e55d5d
parent d72ef4dd707c986620755d159bc467b18150e826
Author: Ivan Tishchenko <ivan.tishchenko@dsr-company.con>
Date: Sat, 10 Jan 2015 17:10:18 +0300
Update :VimikiGenerateTags -- use tags as anchors in links
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim
@@ -1997,7 +1997,7 @@ function! vimwiki#base#update_tags(full_rebuild) "{{{
endfunction " }}}
" vimwiki#base#scan_tags
-" Scans the list (argument) and produces tags metadata dictionary.
+" Scans the list of text lines (argument) and produces tags metadata.
function! vimwiki#base#scan_tags(lines, page_name) "{{{
let metadata = []
@@ -2060,8 +2060,11 @@ function! vimwiki#base#scan_tags(lines, page_name) "{{{
let entry.lineno = line_nr
if line_nr <= (header_line_nr + PROXIMITY_LINES_NR)
let entry.link = page_name . '#' . current_complete_anchor
- else
+ elseif header_line_nr < 0
+ " Tag appeared before the first header
let entry.link = page_name
+ else
+ let entry.link = page_name . '#' . tag
endif
call add(metadata, entry)
endwhile