updates
This commit is contained in:
67
nvim.bak/lua/zinn/plugins/nvim-tree.lua
Normal file
67
nvim.bak/lua/zinn/plugins/nvim-tree.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
-- lua/plugins/nvim-tree.lua
|
||||
return {
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
lazy = false,
|
||||
dependencies = { "nvim-tree/nvim-web-devicons", opts = {} },
|
||||
config = function()
|
||||
require("nvim-tree").setup({
|
||||
disable_netrw = true, -- Disable built-in netrw (recommended)
|
||||
hijack_netrw = true, -- Let nvim-tree handle directory browsing
|
||||
view = {
|
||||
width = 30, -- Fixed width for the sidebar
|
||||
side = "left", -- Position on the left
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true, -- Compact folders that only contain a single folder
|
||||
highlight_git = true, -- Highlight git status
|
||||
icons = {
|
||||
show = {
|
||||
file = true,
|
||||
folder = true,
|
||||
folder_arrow = true,
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false, -- Show dotfiles by default
|
||||
git_ignored = false, -- Show git-ignored files
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
quit_on_open = true, -- Close the tree when opening a file
|
||||
resize_window = true, -- Resize the window to fit the tree
|
||||
},
|
||||
},
|
||||
git = {
|
||||
enable = true, -- Enable git integration
|
||||
ignore = false,
|
||||
},
|
||||
-- Custom on_attach for keybindings
|
||||
on_attach = function(bufnr)
|
||||
local api = require("nvim-tree.api")
|
||||
|
||||
-- Default mappings (these are built-in; see :help nvim-tree-mappings)
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
|
||||
-- Optional: Add or override custom keymaps here
|
||||
-- Example: vim.keymap.set("n", "<C-t>", api.tree.toggle, { buffer = bufnr, desc = "Toggle Nvim-Tree" })
|
||||
end,
|
||||
})
|
||||
|
||||
-- Optional: Auto-open nvim-tree on startup if no file is specified
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
callback = function()
|
||||
if vim.fn.argc() == 0 and vim.fn.getcwd() ~= vim.fn.stdpath("config") then
|
||||
require("nvim-tree.api").tree.open()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Optional: Global keybinding to toggle the tree from anywhere
|
||||
vim.keymap.set("n", "<leader>e", "<cmd>NvimTreeToggle<cr>", { desc = "Toggle File Explorer" })
|
||||
end,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user