diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-10-05 08:46:35 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-10-05 08:46:35 +0200 |
commit | 77cdf208765ad351e48724ed5ad57e55703eca61 (patch) | |
tree | 7f19757b255ab66895d9240a5aca77a35cef8aac /.config/nvim/lua/core/nvimtree.lua | |
parent | 4fd170aa9d55b7bcd1f0a9445c9e136b560e3220 (diff) |
Add major update to LSP from lunarvim
Diffstat (limited to '.config/nvim/lua/core/nvimtree.lua')
-rw-r--r-- | .config/nvim/lua/core/nvimtree.lua | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua index 1e764c7..ff8db15 100644 --- a/.config/nvim/lua/core/nvimtree.lua +++ b/.config/nvim/lua/core/nvimtree.lua @@ -5,8 +5,23 @@ function M.config() options.builtin.nvimtree = { active = true, on_config_done = nil, - side = "left", - width = 30, + setup = { + auto_open = 0, + auto_close = 1, + tab_open = 0, + update_focused_file = { + enable = 1, + }, + lsp_diagnostics = 1, + view = { + width = 30, + side = "left", + auto_resize = false, + mappings = { + custom_only = false, + }, + }, + }, show_icons = { git = 1, folders = 1, @@ -15,16 +30,11 @@ function M.config() tree_width = 30, }, ignore = { ".git", "node_modules", ".cache" }, - auto_open = 0, - auto_close = 1, quit_on_open = 0, - follow = 1, hide_dotfiles = 1, git_hl = 1, root_folder_modifier = ":t", - tab_open = 0, allow_resize = 1, - lsp_diagnostics = 1, auto_ignore_ft = { "startify", "dashboard" }, icons = { default = "", @@ -52,7 +62,7 @@ end function M.setup() local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") if not status_ok then - Log:error("Failed to load nvim-tree.config") + Log:error "Failed to load nvim-tree.config" return end local g = vim.g @@ -63,17 +73,17 @@ function M.setup() -- Implicitly update nvim-tree when project module is active if options.builtin.project.active then - vim.g.nvim_tree_update_cwd = 1 - vim.g.nvim_tree_respect_buf_cwd = 1 - vim.g.nvim_tree_disable_netrw = 0 - vim.g.nvim_tree_hijack_netrw = 0 + options.builtin.nvimtree.respect_buf_cwd = 1 + options.builtin.nvimtree.setup.update_cwd = 1 + options.builtin.nvimtree.setup.disable_netrw = 0 + options.builtin.nvimtree.setup.hijack_netrw = 0 vim.g.netrw_banner = 0 end local tree_cb = nvim_tree_config.nvim_tree_callback - if not g.nvim_tree_bindings then - g.nvim_tree_bindings = { + if not options.builtin.nvimtree.setup.view.mappings.list then + options.builtin.nvimtree.setup.view.mappings.list = { { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" }, { key = "h", cb = tree_cb "close_node" }, { key = "v", cb = tree_cb "vsplit" }, @@ -96,11 +106,18 @@ function M.setup() if options.builtin.nvimtree.on_config_done then options.builtin.nvimtree.on_config_done(nvim_tree_config) end + require("nvim-tree").setup(options.builtin.nvimtree.setup) end function M.on_open() - if package.loaded["bufferline.state"] and options.builtin.nvimtree.side == "left" then - require("bufferline.state").set_offset(options.builtin.nvimtree.width + 1, "") + if + package.loaded["bufferline.state"] + and options.builtin.nvimtree.setup.view.side == "left" + then + require("bufferline.state").set_offset( + options.builtin.nvimtree.setup.view.width + 1, + "" + ) end end |