summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/cfg/nvimtree
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/cfg/nvimtree')
-rw-r--r--.config/nvim/lua/cfg/nvimtree/init.lua24
1 files changed, 15 insertions, 9 deletions
diff --git a/.config/nvim/lua/cfg/nvimtree/init.lua b/.config/nvim/lua/cfg/nvimtree/init.lua
index 37a931e..97cfe03 100644
--- a/.config/nvim/lua/cfg/nvimtree/init.lua
+++ b/.config/nvim/lua/cfg/nvimtree/init.lua
@@ -1,9 +1,13 @@
---if not package.loaded['nvim-tree.view'] then
--- return
---end
-
+-- --if not package.loaded['nvim-tree.view'] then
+-- -- return
+-- --end
+--
local M = {}
-
+local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
+if not status_ok then
+ return
+end
+--
M.config = function()
local g = vim.g
@@ -52,7 +56,7 @@ M.config = function()
symlink = "",
},
}
- local tree_cb = require("nvim-tree.config").nvim_tree_callback
+ local tree_cb = nvim_tree_config.nvim_tree_callback
vim.g.nvim_tree_bindings = {
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
@@ -61,8 +65,10 @@ M.config = function()
}
end
-local view = require "nvim-tree.view"
-
+local view_status_ok, view = pcall(require, "nvim-tree.view")
+if not view_status_ok then
+ return
+end
M.toggle_tree = function()
if view.win_open() then
require("nvim-tree").close()
@@ -77,5 +83,5 @@ M.toggle_tree = function()
require("nvim-tree").find_file(true)
end
end
-
+--
return M