runtime(dist/vim9): fix regressions in dist#vim9#Open
fixes: #16533 fixes: #16532 closes: #16535 Signed-off-by: Luca Saccarola <github.e41mv@aleeas.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
a5d19aa44d
commit
766801295d
@ -12,9 +12,18 @@ command -complete=file -nargs=1 Open vim9.Open(trim(<q-args>))
|
||||
|
||||
const no_gx = get(g:, "nogx", get(g:, "netrw_nogx", false))
|
||||
if !no_gx
|
||||
def GetWordUnderCursor(): string
|
||||
const url = matchstr(expand("<cWORD>"), '\%(\%(http\|ftp\|irc\)s\?\|file\)://\S\{-}\ze[^A-Za-z0-9/]*$')
|
||||
if !empty(url)
|
||||
return url
|
||||
endif
|
||||
|
||||
const user_var = get(g:, 'gx_word', get(g:, 'netrw_gx', '<cfile>')
|
||||
return expand(user_var)
|
||||
enddef
|
||||
|
||||
if maparg('gx', 'n') == ""
|
||||
const file = get(g:, 'netrw_gx', '<cfile>')
|
||||
nnoremap <unique> gx <scriptcmd>vim9.Open(expand(file))<CR>
|
||||
nnoremap <unique> gx <scriptcmd>vim9.Open(GetWordUnderCursor())<CR>
|
||||
endif
|
||||
if maparg('gx', 'x') == ""
|
||||
xnoremap <unique> gx <scriptcmd>vim9.Open(getregion(getpos('v'), getpos('.'), { type: mode() })->join())<CR>
|
||||
|
||||
Reference in New Issue
Block a user