From b912e4e3c702f3ce617e54b846c13e1754e55d5d Mon Sep 17 00:00:00 2001 From: Ivan Tishchenko Date: Sat, 10 Jan 2015 17:10:18 +0300 Subject: [PATCH] Update :VimikiGenerateTags -- use tags as anchors in links --- autoload/vimwiki/base.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 8c0d2a5..d227026 100644 --- 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