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

Rename and rework `IsUrl`

parent 52cfee8c
...@@ -4,9 +4,9 @@ endif ...@@ -4,9 +4,9 @@ endif
let g:loaded_OpenUrl = 1 let g:loaded_OpenUrl = 1
function! OpenUrl#UnderCursor() function! OpenUrl#UnderCursor()
let s:url = OpenUrl#GetWordUnderCursor() let s:word = OpenUrl#GetWordUnderCursor()
let s:is_url = OpenUrl#IsUrl(s:url) let s:url = OpenUrl#GetUrl(s:word)
if s:is_url == 1 if !empty(s:url)
call OpenUrl#WithDefaultBrowser(s:url) call OpenUrl#WithDefaultBrowser(s:url)
else else
call OpenUrl#PassToDarkInvestigate() call OpenUrl#PassToDarkInvestigate()
...@@ -14,7 +14,8 @@ function! OpenUrl#UnderCursor() ...@@ -14,7 +14,8 @@ function! OpenUrl#UnderCursor()
endfunction endfunction
function! OpenUrl#PassToDarkInvestigate() 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') if exists('g:loaded_OpenUrl_DarkInvestigate')
call investigate#Investigate() call investigate#Investigate()
else else
...@@ -43,12 +44,12 @@ function! OpenUrl#OpenWith(app, file) ...@@ -43,12 +44,12 @@ function! OpenUrl#OpenWith(app, file)
endif endif
endfunction endfunction
function! OpenUrl#IsUrl(str) function! OpenUrl#GetUrl(str)
let s:url = matchstr(a:str, '[a-z]*:\/\/[^ >,;]*') let s:url = matchstr(a:str, '[a-z]*:\/\/[^ ">,;]*')
if empty(s:url) if empty(s:url)
return 0 return ''
else else
return 1 return s:url
endif endif
endfunction 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