nixos-config/pkgs/bck-nvim/lua/0-nvimtree.lua

31 lines
803 B
Lua
Raw Normal View History

2024-02-23 05:14:23 +00:00
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
vim.cmd("colorscheme codedark")
vim.keymap.set('n', '<space>e', '<cmd>NvimTreeToggle<cr>')
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
api.config.mappings.default_on_attach(bufnr)
vim.keymap.set('n', 'l', api.node.open.edit, opts('Open'))
vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('Close Directory'))
end
require("nvim-tree").setup({
on_attach = my_on_attach,
disable_netrw = true,
hijack_netrw = true,
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = {
enable = true,
update_root = true
},
})