From fd4b6f4870ff10351a85dbc1269ec9f542bac94f Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Tue, 16 Mar 2021 21:10:12 +0100 Subject: fix(plugin): no netrw for gx. --- plugin/spec.vim | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/spec.vim b/plugin/spec.vim index 6dc02dc..5583a29 100644 --- a/plugin/spec.vim +++ b/plugin/spec.vim @@ -1,5 +1,19 @@ noremap gG :,!abbrevURL -" for netrw +" Doesn't work because of gh#vim/vim#4738 let g:netrw_browsex_viewer='setsid osurl' +" This is just temporary workaround until the above issue is truly +" resolved. +function! OpenURLUnderCursor() + let s:uri = expand('') + echom "s:uri = " . s:uri + " let s:uri = matchstr(getline('.'), '[a-z]*(:\/\/\|#)[^ >,;()]*') + " let s:uri = shellescape(s:uri, 1) + " echom "s:uri = " . s:uri + if s:uri != '' + silent exec "!osurl '".s:uri."'" + :redraw! + endif +endfunction +nnoremap gx :call OpenURLUnderCursor() -- cgit