From 409dfed3237f9f0a6e96879078d1daf3d9c02e03 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 7 Jul 2021 14:10:25 +0200 Subject: Updated config again after Chris's updates --- .config/nvim/lua/cfg/nvimtree/init.lua | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to '.config/nvim/lua/cfg/nvimtree') 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", "", "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 -- cgit v1.2.3-70-g09d2