Nvim-tree.lua: attempt to call field 'win_open' (a nil value)

Created on 14 Apr 2021  路  6Comments  路  Source: kyazdani42/nvim-tree.lua

I don't know if this has to do with a recent update or not but I recently updated my nvim-tree and its giving me this error
nvim-tree

Most helpful comment

Looks like this function was moved to view.lua, and updated slightly (used to be in lib.lua). Changing the call at nvim-tree.lua line 165 from lib.win_open() to view.win_open() does the trick.

All 6 comments

Looks like this function was moved to view.lua, and updated slightly (used to be in lib.lua). Changing the call at nvim-tree.lua line 165 from lib.win_open() to view.win_open() does the trick.

Just a slight oversight from the most recent commit (ff814676), which was made today

I am experiencing the same issue after the update.

diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua
index 0eb4e54..633c77f 100644
--- a/lua/nvim-tree.lua
+++ b/lua/nvim-tree.lua
@@ -162,7 +162,7 @@ end

 function M.on_leave()
   vim.defer_fn(function()
-    if #api.nvim_list_wins() == 1 and lib.win_open() then
+    if #api.nvim_list_wins() == 1 and view.win_open() then
       api.nvim_command(':silent qa!')
     end
   end, 50)
diff --git a/lua/nvim-tree/lib.lua b/lua/nvim-tree/lib.lua
index 6958462..fcf7513 100644
--- a/lua/nvim-tree/lib.lua
+++ b/lua/nvim-tree/lib.lua
@@ -245,7 +245,7 @@ function M.open_file(mode, filename)
   view.resize()

   if vim.g.nvim_tree_quit_on_open == 1 and mode ~= 'preview' then
-    M.close()
+    view.close()
   end

   renderer.draw(M.Tree, true)

It seems like nvim-tree is using a new Neovim api.
Updating Neovim nightly build seems to fix the issue.

sorry, forgot to change this func call. It's fixed in d065927

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gmr458 picture gmr458  路  5Comments

michaelb picture michaelb  路  5Comments

ziulev picture ziulev  路  8Comments

seblj picture seblj  路  6Comments

greister picture greister  路  8Comments