commit 90dc1e58717bd25798bb16d3badab8908b619912
parent 3556de54e1203d03d2a19871217e0a3021a57e01
Author: EinfachToll <istjanichtzufassen@googlemail.com>
Date: Tue, 17 Apr 2018 08:53:08 +0200
Make ]] work when cursor is above first header
Ref #462
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim
@@ -1748,6 +1748,8 @@ function! vimwiki#base#goto_next_header()
let current_header_index = s:current_header(headers, line('.'))
if current_header_index >= 0 && current_header_index < len(headers) - 1
call cursor(headers[current_header_index + 1][0], 1)
+ elseif current_header_index < 0 && !empty(headers) " we're above the first header
+ call cursor(headers[0][0], 1)
else
echo 'Vimwiki: no next header found'
endif
@@ -1764,7 +1766,7 @@ function! vimwiki#base#goto_prev_header()
if current_header_index >= 0
call cursor(headers[current_header_index][0], 1)
else
- echom 'Vimwiki: no previous header found'
+ echo 'Vimwiki: no previous header found'
endif
endfunction