-
-
Notifications
You must be signed in to change notification settings - Fork 638
Closed
Description
Description
I updated nvim-tree the other day and now get errors when trying to call require('nvim-tree.lib').get_node_at_cursor().name which I'm using in a autocmd (see below).
Now I noticed this was moved to the explorer module so I updated the line to require('nvim-tree.explorer').get_node_at_cursor().name) but that didn't fix anything so I wondered how I should/can call this method to prevent getting errors.
Thanks!
Neovim version
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1727870382
Operating system and version
macOS 15.0.1
nvim-tree version
nvim-tree-v1.8.0 - commit c763948
Clean room replication
Put this anywhere in your vim config:
autocmd('CursorMoved', {
pattern = 'NvimTree*',
callback = function()
print('NvimTree: ' .. require('nvim-tree.explorer').get_node_at_cursor().name)
end
})Steps to reproduce
- Open vim and toggle the tree
Expected behavior
The tree opens without errors and when moving around it prints the full name of the node.
Actual behavior
It throws these errors:
Error detected while processing CursorMoved Autocommands for "NvimTree*":
Error executing lua callback: .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/init.lua:499: attempt to index local 'self' (a nil value)
stack traceback:
.../nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/init.lua:499: in function 'get_node_at_cursor'
/Users/svanharmelen/.config/nvim/lua/plugins/nvim-tree.lua:105: in function </Users/svanharmelen/.config/nvim/lua/plugins/nvim-tree.lua:104>
Metadata
Metadata
Assignees
Labels
No labels