Nicer error message when linking to not registered wiki

This commit is contained in:
EinfachToll 2018-10-15 07:36:41 +02:00
parent e6d0678b54
commit 76f51f1dba

View File

@ -174,6 +174,7 @@ function! vimwiki#base#resolve_link(link_text, ...)
if link_infos.scheme =~# '\mwiki\d\+' if link_infos.scheme =~# '\mwiki\d\+'
let link_infos.index = eval(matchstr(link_infos.scheme, '\D\+\zs\d\+\ze')) let link_infos.index = eval(matchstr(link_infos.scheme, '\D\+\zs\d\+\ze'))
if link_infos.index < 0 || link_infos.index >= vimwiki#vars#number_of_wikis() if link_infos.index < 0 || link_infos.index >= vimwiki#vars#number_of_wikis()
let link_infos.index = -1
let link_infos.filename = '' let link_infos.filename = ''
return link_infos return link_infos
endif endif
@ -268,7 +269,11 @@ function! vimwiki#base#open_link(cmd, link, ...)
endif endif
if link_infos.filename == '' if link_infos.filename == ''
echomsg 'Vimwiki Error: Unable to resolve link!' if link_infos.index == -1
echomsg 'Vimwiki Error: No registered wiki ''' . link_infos.scheme . '''.'
else
echomsg 'Vimwiki Error: Unable to resolve link!'
endif
return return
endif endif