From d5fe78bf317694228b0f95a13e89ffbfec768777 Mon Sep 17 00:00:00 2001 From: aminnairi <18418459+aminnairi@users.noreply.github.com> Date: Thu, 21 Dec 2023 18:54:34 +0100 Subject: [PATCH] using local variable instead of calling the require on each keybind for nvim tree --- nvim/lua/settings/lazy/plugins/nvimtree.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nvim/lua/settings/lazy/plugins/nvimtree.lua b/nvim/lua/settings/lazy/plugins/nvimtree.lua index 73f5e24..54a6fba 100644 --- a/nvim/lua/settings/lazy/plugins/nvimtree.lua +++ b/nvim/lua/settings/lazy/plugins/nvimtree.lua @@ -8,6 +8,8 @@ return { vim.g.loaded_netrwPlugin = 1 vim.opt.termguicolors = true + local nvimTreeApi = require("nvim-tree.api") + require("nvim-tree").setup({ auto_reload_on_write = true, sort_by = "case_sensitive", @@ -30,25 +32,25 @@ return { name = "NvimTree", t = { function() - require("nvim-tree.api").tree.toggle() + nvimTreeApi.tree.toggle() end, "Toggle NvimTree", }, f = { function() - require("nvim-tree.api").tree.focus() + nvimTreeApi.tree.focus() end, "Focus NvimTree", }, e = { function() - require("nvim-tree.api").tree.expand_all() + nvimTreeApi.tree.expand_all() end, "Expand NvimTree", }, c = { function() - require("nvim-tree.api").tree.collapse_all() + nvimTreeApi.tree.collapse_all() end, "Collapse NvimTree", },