This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
api.tree.toggle doesn't work when setup is called right before it in a mapping #2050
Labels
bug
Something isn't working
Description
I am trying to manually lazy load nvim-tree on a mapping
<leader>n
, so I setup config like normally would but moved setup to be called in the mapping function. But I realized that when setup is called, followed byapi.tree.toggle
in the map, it always opens the tree window and never closes it. NOTE: but if I call the setup function outside of the mapping function .ievim.keymap.set
everything works normal . But because I am trying to lazy load nvim-tree, calling setup outside of the map isn't an option. In addition, theapi.tree.open
andapi.tree.close
work perfectly when mapped (.ie setup function then api.tree.*) only toggle isn't working for me.I think this issue is manifest in
view.is_visible()
in thetoggle fn
Neovim version
Operating system and version
Archlinux, Linux malpha 6.2.2-zen2-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Wed, 08 Mar 2023 04:07:25 +0000 x86_64 GNU/Linux
nvim-tree version
bbb6d48
Minimal config
Steps to reproduce
,n
,n
again to toggle the tree. The NvimTree doesn't close but refreshes/opens again.Expected behavior
I expected that the
,n
mapping toggles the window .ie it opens it first and closes it afterward.Actual behavior
The tree opens as expected but the next
,n
press doesn't close/toggle the treeThe text was updated successfully, but these errors were encountered: