mirror of
https://github.com/neovim/neovim.git
synced 2026-07-24 09:50:48 +00:00
fix(dir): custom 3P directory-browser #40725
Problem: Third-party directory browsers do not have a documented way to take over local directory buffers from nvim.dir. Solution: Document deleting the nvim.dir augroup and handling FileType directory as the after-startup handoff, and avoid installing the built-in buffer-local "-" mapping when "-" is already mapped.
This commit is contained in:
@@ -185,8 +185,15 @@ local function set_maps(buf)
|
||||
vim.keymap.set('n', lhs, plug, { buffer = buf, silent = true })
|
||||
end
|
||||
end
|
||||
---@param lhs string
|
||||
---@param plug string
|
||||
local function default_map(lhs, plug)
|
||||
if vim.fn.mapcheck(lhs, 'n') == '' and vim.fn.hasmapto(plug, 'n') == 0 then
|
||||
vim.keymap.set('n', lhs, plug, { buffer = buf, silent = true })
|
||||
end
|
||||
end
|
||||
map('<CR>', '<Plug>(nvim-dir-open)')
|
||||
map('-', '<Plug>(nvim-dir-up)')
|
||||
default_map('-', '<Plug>(nvim-dir-up)')
|
||||
map('R', '<Plug>(nvim-dir-reload)')
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user