nvim-tree / nvim-tree.lua

A file explorer tree for neovim written in lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API: Tree Is Open

alex-courtis opened this issue · comments

view.is_open() can and is used: https://github.com/nvim-tree/nvim-tree.lua/wiki/Recipes#workaround-when-using-rmagattiauto-session

There is no API to achieve this.

api.tree.is_open or api.tree.state.open might be appropriate.

Multiple tabs could be handled with, say, an argument current tab or all tabs.

See #1992 (comment)

/cc @nikolasmish

There is require('nvim-tree.view').is_visible()

That's not part of contractual API though.

That's not part of contractual API though.

Yes. They would probably be the same under the hood.

nvim-tree-api.tree.is_visible() was added.

@alex-courtis could you clarify how this new api affects the workaround? Would it be:

local api = require('nvim-tree-api')
if not api.tree.is_visible() then
  api.tree.open()
end

??

@alex-courtis could you clarify how this new api affects the workaround? Would it be:

Yes. I thought I updated that, however it looks like it was recently changed.

Please test and update the wiki page on success.