Commit b23db5dc authored by Marco Kellershoff's avatar Marco Kellershoff 🤸

Rename and rework `IsUrl`

parent 52cfee8c
......@@ -4,9 +4,9 @@ endif
let g:loaded_OpenUrl = 1
function! OpenUrl#UnderCursor()
let s:url = OpenUrl#GetWordUnderCursor()
let s:is_url = OpenUrl#IsUrl(s:url)
if s:is_url == 1
let s:word = OpenUrl#GetWordUnderCursor()
let s:url = OpenUrl#GetUrl(s:word)
if !empty(s:url)
call OpenUrl#WithDefaultBrowser(s:url)
else
call OpenUrl#PassToDarkInvestigate()
......@@ -14,7 +14,8 @@ function! OpenUrl#UnderCursor()
endfunction
function! OpenUrl#PassToDarkInvestigate()
let s:url = OpenUrl#GetWordUnderCursor()
let s:word = OpenUrl#GetWordUnderCursor()
let s:url = OpenUrl#GetUrl(s:word)
if exists('g:loaded_OpenUrl_DarkInvestigate')
call investigate#Investigate()
else
......@@ -43,12 +44,12 @@ function! OpenUrl#OpenWith(app, file)
endif
endfunction
function! OpenUrl#IsUrl(str)
let s:url = matchstr(a:str, '[a-z]*:\/\/[^ >,;]*')
function! OpenUrl#GetUrl(str)
let s:url = matchstr(a:str, '[a-z]*:\/\/[^ ">,;]*')
if empty(s:url)
return 0
return ''
else
return 1
return s:url
endif
endfunction
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment