Commits

Audrius Kažukauskas committed ace245b

Use xdg-open to open URLs using default browser.

Comments (0)

Files changed (1)

 " Use %% to represent directory of the file in the current buffer.
 cabbrev         <expr> %%       expand('%:~:h')
 
-" Open URI in browser.
-func! OpenURI()
-  let uri = getline('.')
-  let uri = matchstr(uri, '\(http\|ftp\|file\)[^ \t>"' . nr2char(39) . ']\+')
-  if uri == ''
-    echo 'No URI found in line.'
+" Open URL in browser.
+func! OpenURL()
+  let url = getline('.')
+  let url = matchstr(url, '\(http\|ftp\|file\)[^ \t>"' . nr2char(39) . ']\+')
+  if url == ''
+    echo 'No URL found in line.'
   else
-    let uri = escape(uri, '#&;|%')
-    exec 'silent !opera "' . uri . '" &> /dev/null'
+    let url = escape(url, '#&;|%')
+    exec 'silent !xdg-open "' . url . '" &> /dev/null'
     if !has('gui_running')
       redraw!
     endif
   endif
 endfunc
-map <silent> <leader>u :call OpenURI()<CR>
+map <silent> <leader>u :call OpenURL()<CR>
 
 " Tabular.vim mappings.
 nmap <leader>a= :Tabularize /=<CR>