From cc82d88e2a791f54d2b6e2b26e41f743351ac947 Mon Sep 17 00:00:00 2001 From: Sammy Johnatan Carbajal Ipenza Date: Tue, 28 Feb 2023 17:24:37 +0100 Subject: [PATCH] Expand relative path URL using host path separator --- ftplugin/markdown.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index 4c4c85ea..60505cd3 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -656,7 +656,12 @@ endfunction function! s:OpenUrlUnderCursor() let l:url = s:Markdown_GetUrlForPosition(line('.'), col('.')) if l:url !=# '' - call s:VersionAwareNetrwBrowseX(l:url) + if l:url =~? 'http[s]\?:\/\/[[:alnum:]%\/_#.-]*' + "Do nothing + else + let l:url = expand(expand('%:h').'/'.l:url) + endif + call s:VersionAwareNetrwBrowseX(l:url) else echomsg 'The cursor is not on a link.' endif