33 lines
967 B
Lua
33 lines
967 B
Lua
vim.pack.add{"https://github.com/nvim-tree/nvim-tree.lua"}
|
|
|
|
local function my_on_attach(bufnr)
|
|
local api = require("nvim-tree.api")
|
|
|
|
local function opts(desc)
|
|
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
|
end
|
|
|
|
-- 1. Apply default mappings first
|
|
api.config.mappings.default_on_attach(bufnr)
|
|
|
|
-- 2. OVERRIDE Enter key to force-open and instantly flush command line blocks
|
|
vim.keymap.set("n", "<CR>", function()
|
|
-- Open the file natively
|
|
api.node.open.edit()
|
|
|
|
-- Force-clear any hidden "Press Enter" or UI pager messages
|
|
vim.cmd("echo '' | redraw")
|
|
end, opts("Open file instantly"))
|
|
end
|
|
|
|
require("nvim-tree").setup({
|
|
on_attach = my_on_attach,
|
|
actions = {
|
|
open_file = {
|
|
window_picker = {
|
|
enable = false, -- Keep this off to prevent extra prompt overhead
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|