Skip to content

Instantly share code, notes, and snippets.

@gaving
Created October 24, 2010 16:37
Show Gist options
  • Select an option

  • Save gaving/643662 to your computer and use it in GitHub Desktop.

Select an option

Save gaving/643662 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment