runtime: decouple Open and Launch commands and gx mapping from netrw
closes: #16494 fixes: ##16486 Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
d65aa1bbdb
commit
c729d6d154
24
runtime/plugin/openPlugin.vim
Normal file
24
runtime/plugin/openPlugin.vim
Normal file
@ -0,0 +1,24 @@
|
||||
vim9script
|
||||
|
||||
# Vim runtime support library
|
||||
#
|
||||
# Maintainer: The Vim Project <https://github.com/vim/vim>
|
||||
# Last Change: 2025 Jan 24
|
||||
|
||||
import autoload 'dist/vim9.vim'
|
||||
|
||||
command -complete=shellcmd -nargs=1 Launch vim9.Launch(trim(<q-args>))
|
||||
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
|
||||
if maparg('gx', 'n') == ""
|
||||
const file = get(g:, 'netrw_gx', '<cfile>')
|
||||
nnoremap <unique> gx <scriptcmd>vim9.Open(expand(file))<CR>
|
||||
endif
|
||||
if maparg('gx', 'x') == ""
|
||||
xnoremap <unique> gx <scriptcmd>vim9.Open(getregion(getpos('v'), getpos('.'), { type: mode() })->join())<CR>
|
||||
endif
|
||||
endif
|
||||
|
||||
# vim: ts=8 sts=2 sw=2 et
|
||||
Reference in New Issue
Block a user