Clean URLs that don't have slashes

Will fix normalization of links like [[local:./foo.txt]]
Also, allow schemes to end with a number, so that e.g. [[wiki1:foo]]
will normalize as expected.
This commit is contained in:
Fredrik Arnerup 2018-09-17 12:20:17 +02:00 committed by Michael F. Schönitzer
parent 5605f285c1
commit f639c0a342

View File

@ -1861,7 +1861,8 @@ endfunction
function! s:clean_url(url)
" remove protocol and tld
let url = substitute(a:url, '^\a\+://', '', '')
let url = substitute(a:url, '^\a\+\d*:', '', '')
let url = substitute(url, '^//', '', '')
let url = substitute(url, '^\([^/]\+\).\a\{2,4}/', '\1/', '')
let url = split(url, '/\|=\|-\|&\|?\|\.')
let url = filter(url, 'v:val !=# ""')