Adding nvim-tree

This commit is contained in:
Thomas Dorsch 2025-08-13 07:19:01 +00:00
parent a701962f67
commit d7f4fef599
2 changed files with 54 additions and 0 deletions

View File

@ -3,6 +3,10 @@
--
-- See the kickstart.nvim README for more information
-- Disabled netrw plugin, because we will use nvim-tree
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- Set the blinking cursor settings
vim.o.guicursor = 'n-v:block,i:ver25,r-cr-o:hor20,a:blinkwait700-blinkoff400-blinkon250'

View File

@ -0,0 +1,50 @@
return {
'nvim-tree/nvim-tree.lua',
version = '*',
lazy = false,
dependencies = {
'nvim-tree/nvim-web-devicons',
},
config = function()
require('nvim-tree').setup {
filters = {
dotfiles = true,
},
}
-- Helper function to setup a custom keybindings when nvim-tree buffer is active
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
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- add/overwrite custom mappings
vim.keymap.set('n', '?', api.tree.toggle_help, opts 'Help')
end
-- pass to setup along with your other options
require('nvim-tree').setup {
---
on_attach = my_on_attach,
---
}
-- fix the width of nvim tree if once adjusted.
require('nvim-tree').setup {
actions = {
open_file = {
quit_on_open = false, -- important: don't quit tree immediately
resize_window = false, -- prevent auto-resizing
},
},
}
-- Keybinding in "normal" vi mode
local anotherApi = require 'nvim-tree.api'
vim.keymap.set('n', '<leader>t', anotherApi.tree.toggle, { desc = 'Toogle nvim-tree' })
end,
}