vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit b794a3bd3b6b4f0f26ff2eb227c2a1ba7de7fb72
parent debd308eeaa33ad21bbe07b61b8d9d17b4905280
Author: EinfachToll <istjanichtzufassen@googlemail.com>
Date:   Sat, 21 Nov 2015 21:20:33 +0100

Restrict the distance of tag to header to two lines

Suffices, I think.
Also, clean the code a bit and correct the help file.

Ref #85

Diffstat:
Mautoload/vimwiki/tags.vim | 11++++++-----
Mdoc/vimwiki.txt | 9+++++----
2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/autoload/vimwiki/tags.vim b/autoload/vimwiki/tags.vim @@ -62,7 +62,6 @@ endfunction " }}} function! s:scan_tags(lines, page_name) "{{{ let entries = [] - let page_name = a:page_name " Code wireframe to scan for headers -- borrowed from " vimwiki#base#get_anchors(), with minor modifications. @@ -73,7 +72,7 @@ function! s:scan_tags(lines, page_name) "{{{ let anchor_level = ['', '', '', '', '', '', ''] let current_complete_anchor = '' - let PROXIMITY_LINES_NR = 5 + let PROXIMITY_LINES_NR = 2 let header_line_nr = - (2 * PROXIMITY_LINES_NR) for line_nr in range(1, len(a:lines)) @@ -121,11 +120,13 @@ function! s:scan_tags(lines, page_name) "{{{ let entry.lineno = line_nr if line_nr <= PROXIMITY_LINES_NR && header_line_nr < 0 " Tag appeared at the top of the file - let entry.link = page_name + let entry.link = a:page_name elseif line_nr <= (header_line_nr + PROXIMITY_LINES_NR) - let entry.link = page_name . '#' . current_complete_anchor + " Tag appeared right below a header + let entry.link = a:page_name . '#' . current_complete_anchor else - let entry.link = page_name . '#' . tag + " Tag stands on its own + let entry.link = a:page_name . '#' . tag endif call add(entries, entry) endfor diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt @@ -1227,10 +1227,11 @@ A tag is a sequence of non-space characters between two colons: > It is allowed to concatenate multiple tags in one line: > :tag-one:tag-two: < -If placed under a header, within 5 lines below it, the header is then "tagged" -with this tag, and tag search commands will jump to this specific header. -Otherwise the entire page is tagged, and search commands will jump -accordingly. +If placed in the first two lines of a file, the whole file is tagged. If +placed under a header, within the 2 lines below it, the header is then tagged +with this tag, and the tag search commands will jump to this specific header. +Otherwise, the tag stands of its own and the search command jumps directly to +it. Typing tags can be simplified by using Vim's omni completion (see |compl-omni|) like so: >