From c8b6a02f8a9e4cf8cae6065f161a2ef262790984 Mon Sep 17 00:00:00 2001 From: typebrook Date: Fri, 19 Oct 2018 00:35:09 +0800 Subject: Add utility to open link in browser --- .vimrc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.vimrc b/.vimrc index 0c84aea..77e51e9 100644 --- a/.vimrc +++ b/.vimrc @@ -9,6 +9,22 @@ set mouse=a nmap :q +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Open URL under cursor +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Solution is here: https://stackoverflow.com/questions/9458294/ +function! HandleURL() + let s:uri = matchstr(getline("."), '[a-z]*:\/\/[^ >,;]*') + echo s:uri + if s:uri != "" + silent exec "!xdg-open ".s:uri."" + else + echo "No URI found in line." + endif +endfunction +nmap gx :call HandleURL() + + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Make Alt key works on Gnome terminal """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -- cgit v1.2.3-70-g09d2