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'
|
||||
|
@ -220,8 +220,6 @@ function! vimwiki#diary#make_note(wnum, ...)
|
||||
return
|
||||
endif
|
||||
|
||||
" TODO: refactor it. base#goto_index uses the same
|
||||
|
||||
call vimwiki#path#mkdir(vimwiki#vars#get_wikilocal('path', wiki_nr).
|
||||
\ vimwiki#vars#get_wikilocal('diary_rel_path', wiki_nr))
|
||||
|
||||
@ -244,20 +242,23 @@ function! vimwiki#diary#make_note(wnum, ...)
|
||||
call vimwiki#base#open_link(cmd, link, s:diary_index(wiki_nr))
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#diary#goto_diary_index(wnum)
|
||||
|
||||
" if wnum = 0 the current wiki is used
|
||||
if a:wnum == 0
|
||||
let idx = vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
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 g:vimwiki_list!'
|
||||
return
|
||||
endif
|
||||
|
||||
" TODO: refactor it. base#goto_index uses the same
|
||||
if a:wnum > 0
|
||||
let idx = a:wnum - 1
|
||||
else
|
||||
let idx = 0
|
||||
endif
|
||||
|
||||
call vimwiki#base#edit_file('e', s:diary_index(idx), '')
|
||||
|
||||
if vimwiki#vars#get_wikilocal('auto_diary_index')
|
||||
|
Reference in New Issue
Block a user