Fix problems with commands not taking a count and mapping behavior.
Commands such as :VimwikiIndex and :VimwikiDiaryIndex did not previously take a count and the doucmentation was inconsistent/incorrect for the behavior of these commands. Fixes #543.
This commit is contained in:
@ -1287,19 +1287,23 @@ endfunction
|
||||
|
||||
|
||||
function! vimwiki#base#goto_index(wnum, ...)
|
||||
|
||||
" if wnum = 0 the current wiki is used
|
||||
if a:wnum == 0
|
||||
let idx = vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
echom idx
|
||||
if idx < 0 " not in a wiki
|
||||
let idx = 0
|
||||
endif
|
||||
else
|
||||
let idx = a:wnum - 1 " convert to 0 based counting
|
||||
endif
|
||||
|
||||
if a:wnum > vimwiki#vars#number_of_wikis()
|
||||
echomsg 'Vimwiki Error: Wiki '.a:wnum.' is not registered in your Vimwiki settings!'
|
||||
return
|
||||
endif
|
||||
|
||||
" usually a:wnum is greater then 0 but with the following command it is == 0:
|
||||
" vim -n -c ":VimwikiIndex"
|
||||
if a:wnum > 0
|
||||
let idx = a:wnum - 1
|
||||
else
|
||||
let idx = 0
|
||||
endif
|
||||
|
||||
if a:0
|
||||
if a:1 == 1
|
||||
let cmd = 'tabedit'
|
||||
|
Reference in New Issue
Block a user