diff --git a/init.lua b/init.lua index 20d2a4a6..38499dc5 100644 --- a/init.lua +++ b/init.lua @@ -49,7 +49,7 @@ Kickstart Guide: - - : - Tutor - - + - disa (If you already know the Neovim basics, you can skip this step.) @@ -237,7 +237,39 @@ require('lazy').setup({ -- -- Use `opts = {}` to force a plugin to be loaded. -- + { + 'nvim-tree/nvim-tree.lua', + version = '*', + lazy = false, + dependencies = { + 'nvim-tree/nvim-web-devicons', + enabled = true, + }, + config = function() + require('nvim-tree').setup {} + 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) + + -- custom mappings + vim.keymap.set('n', '', api.tree.change_root_to_parent, opts 'Up') + 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, + --- + } + end, + }, -- Here is a more advanced example where we pass configuration -- options to `gitsigns.nvim`. This is equivalent to the following Lua: -- require('gitsigns').setup({ ... })