mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
fix(runtime): don't set gx mapping if already mapped (#24262)
This matches netrw's use of maparg().
This commit is contained in:
parent
317038e7cb
commit
df297e3c2b
@ -36,9 +36,13 @@ local function do_open(uri)
|
||||
vim.notify(err, vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
vim.keymap.set({ 'n' }, 'gx', function()
|
||||
do_open(vim.fn.expand('<cfile>'))
|
||||
end, { desc = gx_desc })
|
||||
vim.keymap.set({ 'x' }, 'gx', function()
|
||||
do_open(get_visual_selection())
|
||||
end, { desc = gx_desc })
|
||||
if vim.fn.maparg('gx', 'n') == '' then
|
||||
vim.keymap.set({ 'n' }, 'gx', function()
|
||||
do_open(vim.fn.expand('<cfile>'))
|
||||
end, { desc = gx_desc })
|
||||
end
|
||||
if vim.fn.maparg('gx', 'x') == '' then
|
||||
vim.keymap.set({ 'x' }, 'gx', function()
|
||||
do_open(get_visual_selection())
|
||||
end, { desc = gx_desc })
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user