2024-04-22 14:52:03 +00:00
|
|
|
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
|
|
|
|
|
2024-04-22 18:47:03 +00:00
|
|
|
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)'))
|
2024-04-22 21:07:38 +00:00
|
|
|
end,
|
|
|
|
filters = {
|
|
|
|
custom = { "^\\.git", "^\\node_modules" }
|
|
|
|
}
|
2024-04-22 18:47:03 +00:00
|
|
|
})
|
2024-04-22 14:52:03 +00:00
|
|
|
|
|
|
|
local api = require('nvim-tree.api')
|
2024-04-22 18:47:03 +00:00
|
|
|
vim.keymap.set('n', '<leader>e', api.tree.toggle, { desc = "Toggle file explorer" })
|
2024-04-22 14:52:03 +00:00
|
|
|
end
|
|
|
|
}
|