vim/runtime/plugin/openPlugin.vim
Luca Saccarola c729d6d154
runtime: decouple Open and Launch commands and gx mapping from netrw
closes: #16494
fixes: ##16486

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-01-25 16:07:12 +01:00

24 lines
704 B
VimL

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