소스 검색

fixing broken nvimtree (#1012)

Abouzar Parvan 4 년 전
부모
커밋
6e6a4a96e0
1개의 변경된 파일8개의 추가작업 그리고 8개의 파일을 삭제
  1. 8 8
      lua/core/nvimtree.lua

+ 8 - 8
lua/core/nvimtree.lua

@@ -1,8 +1,4 @@
 local M = {}
-local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
-if not status_ok then
-  return
-end
 --
 M.config = function()
   O.plugin.nvimtree = {
@@ -50,6 +46,10 @@ M.config = function()
 end
 --
 M.setup = function()
+  local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
+  if not status_ok then
+    return
+  end
   local g = vim.g
 
   for opt, val in pairs(O.plugin.nvimtree) do
@@ -65,12 +65,12 @@ M.setup = function()
   }
 end
 --
-local view_status_ok, view = pcall(require, "nvim-tree.view")
-if not view_status_ok then
-  return
-end
 --
 M.toggle_tree = function()
+  local view_status_ok, view = pcall(require, "nvim-tree.view")
+  if not view_status_ok then
+    return
+  end
   if view.win_open() then
     require("nvim-tree").close()
     if package.loaded["bufferline.state"] then