Fix error when trying to make a link out of '-'

Fix #582
This commit is contained in:
EinfachToll 2018-12-14 21:03:46 +01:00
parent a72c14da1c
commit 645ae61dc3

View File

@ -1898,7 +1898,7 @@ function! s:clean_url(url)
" remove protocol and tld " remove protocol and tld
let url = substitute(a:url, '^\a\+\d*:', '', '') let url = substitute(a:url, '^\a\+\d*:', '', '')
let url = substitute(url, '^//', '', '') let url = substitute(url, '^//', '', '')
let url = substitute(url, '^\([^/]\+\).\a\{2,4}/', '\1/', '') let url = substitute(url, '^\([^/]\+\)\.\a\{2,4}/', '\1/', '')
let url = split(url, '/\|=\|-\|&\|?\|\.') let url = split(url, '/\|=\|-\|&\|?\|\.')
let url = filter(url, 'v:val !=# ""') let url = filter(url, 'v:val !=# ""')
if url[0] == "www" if url[0] == "www"
@ -2010,9 +2010,8 @@ function! s:normalize_link_syntax_n()
if s:is_diary_file(expand("%:p")) if s:is_diary_file(expand("%:p"))
let sub = s:normalize_link_in_diary(lnk) let sub = s:normalize_link_in_diary(lnk)
else else
let sub = vimwiki#base#normalize_link_helper(lnk, let sub = s:safesubstitute(
\ vimwiki#vars#get_global('rxWord'), '', \ vimwiki#vars#get_global('WikiLinkTemplate1'), '__LinkUrl__', lnk, '')
\ vimwiki#vars#get_global('WikiLinkTemplate1'))
endif endif
call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub) call vimwiki#base#replacestr_at_cursor('\V'.lnk, sub)
return return