Skip to content

Instantly share code, notes, and snippets.

@tyru
Created May 9, 2011 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyru/962695 to your computer and use it in GitHub Desktop.
Save tyru/962695 to your computer and use it in GitHub Desktop.
function! HandleURI()
let s:uri = matchstr(getline("."), '[a-z]*:\/\/[^ >,;:]*')
echo s:uri
if s:uri != ""
exec "!open \"" . s:uri . "\""
else
echo "No URI found in line."
endif
endfunction
map <Leader>w :call HandleURI()<CR>
function! s:HandleURI()
let uri = matchstr(getline("."), '[a-z]*:\/\/[^ >,;:]*')
echo uri
if uri != ""
exec "!open \"" . uri . "\""
else
echo "No URI found in line."
endif
endfunction
nnoremap <Leader>w :<C-u>call <SID>HandleURI()<CR>
@tyru
Copy link
Author

tyru commented May 9, 2011

あれ、いつのまにか2個のファイルができてる。なんでだろ。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment