Skip to content

How to access nvimtree state? Want to toggle on focus, but not if already open. #1681

@rtviii

Description

@rtviii

Hi there. I'd like to be able to swithc between buffer focus and nvimtree focus without toggling the tree needlessly. How do i find out the state of the tree? What's the best way to accomplish this otherwise?
In pseudocode, im roughly trying to do something like this :

function my_utility()
    if (nvimtree_is_open) 
    
             vim.cmd("NvimTreeFocus")
    else:
              vim.cmd("NvimTreeToggle")
              vim.cmd("NvimTreeFocus")
end

Thank you

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions