Fix netrw gx

This commit is contained in:
Loic Nageleisen 2020-12-21 18:12:13 +01:00
parent 3cda41136c
commit 237f571f46

13
vimrc
View file

@ -164,6 +164,19 @@ function! ResCur()
endif endif
endfunction endfunction
"fix netrw gx brokenness: https://github.com/vim/vim/issues/4738
if has('macunix')
function! OpenURLUnderCursor()
let s:uri = matchstr(getline('.'), '[a-z]*:\/\/[^ >,;()]*')
let s:uri = shellescape(s:uri, 1)
if s:uri != ''
silent exec "!open '".s:uri."'"
:redraw!
endif
endfunction
nnoremap gx :call OpenURLUnderCursor()<CR>
endif
" Unfold at cursor position " Unfold at cursor position
if has("folding") if has("folding")
function! UnfoldCur() function! UnfoldCur()