From f639c0a342602aae9ec5cb881d8301c6f001e6c8 Mon Sep 17 00:00:00 2001 From: Fredrik Arnerup Date: Mon, 17 Sep 2018 12:20:17 +0200 Subject: [PATCH] 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. --- autoload/vimwiki/base.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 0f399ea..3a81b57 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -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 !=# ""')