43 lines
1.2 KiB
Lua
43 lines
1.2 KiB
Lua
return {
|
|
'nvim-tree/nvim-tree.lua',
|
|
version = '*',
|
|
lazy = false,
|
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
|
config = function()
|
|
vim.g.loaded_netrw = 1
|
|
vim.g.loaded_netrwPlugin = 1
|
|
vim.opt.termguicolors = true
|
|
|
|
require('nvim-tree').setup({
|
|
tab = {
|
|
sync = {
|
|
open = true,
|
|
close = true
|
|
}
|
|
},
|
|
on_attach = function(bufnr)
|
|
local api = require('nvim-tree.api')
|
|
local lib = require('nvim-tree.lib')
|
|
api.config.mappings.default_on_attach(bufnr)
|
|
|
|
local function opts(desc)
|
|
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
|
end
|
|
|
|
vim.keymap.set('n', '<CR>', function()
|
|
local node = lib.get_node_at_cursor()
|
|
api.node.open.tab()
|
|
if node.type == 'file' then
|
|
vim.cmd('wincmd l')
|
|
vim.cmd('tabprevious')
|
|
end
|
|
api.tree.focus()
|
|
end, opts('Open: New Tab (unfocused)'))
|
|
end
|
|
})
|
|
|
|
local api = require('nvim-tree.api')
|
|
vim.keymap.set('n', '<leader>e', api.tree.toggle, { desc = "Toggle file explorer" })
|
|
end
|
|
}
|