diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 021333c..16b6384 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -2119,6 +2119,7 @@ function! s:clean_url(url) abort let url = substitute(a:url, '\'.vimwiki#vars#get_wikilocal('ext').'$', '', '') " remove protocol and tld let url = substitute(url, '^\a\+\d*:', '', '') + " remove absolute path prefix let url = substitute(url, '^//', '', '') let url = substitute(url, '^\([^/]\+\)\.\a\{2,4}/', '\1/', '') let url_l = split(url, '/\|=\|-\|&\|?\|\.') @@ -2129,8 +2130,10 @@ function! s:clean_url(url) abort if url_l[-1] =~# '^\(htm\|html\|php\)$' let url_l = url_l[0:-2] endif - " remove words consisting of only hexadecimal digits or non-word characters - let url_l = filter(url_l, 'v:val !~? "^\\A\\{4,}$"') + " remove words with black listed codepoints + " TODO mutualize blacklist in a variable + let url_l = filter(url_l, 'v:val !~? "[!\"$%&''()*+,:;<=>?\[\]\\^`{}]"') + " remove words consisting of only hexadecimal digits let url_l = filter(url_l, 'v:val !~? "^\\x\\{4,}$" || v:val !~? "\\d"') return join(url_l, ' ') endfunction diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim index 1f94bf0..1a92955 100644 --- a/autoload/vimwiki/vars.vim +++ b/autoload/vimwiki/vars.vim @@ -86,6 +86,7 @@ function! s:populate_global_variables() abort " buffer (and not on a link) to create a link " basically, it's Ascii alphanumeric characters plus #|./@-_~ plus all " non-Ascii characters, except that . is not accepted as the last character + " TODO look behind for . reduces the second part of the regex that is the same with '.' added let g:vimwiki_global_vars.rxWord = '[^[:blank:]!"$%&''()*+,:;<=>?\[\]\\^`{}]*[^[:blank:]!"$%&''()*+.,:;<=>?\[\]\\^`{}]' let g:vimwiki_global_vars.rx_wikilink_prefix1 = g:vimwiki_global_vars.rx_wikilink_prefix .