Skip to content

QUESTION: Call API (add, add_directory, etc) programmatically #1654

@Nekketsu

Description

@Nekketsu

Did you check the docs?

  • I have read all the docs.

Is your feature request related to a problem? Please describe.

I'd like to integrate neo-tree with other plugins. I'd like to call methods like add_directory and show the neo-tree interface to create a directory from another plugin. How can I do that?

Describe the solution you'd like.

I'd like to call add_directory programmatically. All the tests I have tried thinks like this:

local manager = require("neo-tree.sources.manager")
local commands = require("neo-tree.sources.filesystem.commands")

local state = manager.get_state_for_window()
commands.add_directory(state)

But I get errors like:

   Error  02:40:56 notify.error ...y/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:25: attempt to index field 'config' (a nil value)

In addition, I think that my implementation focuses on filesystem, but I'd like it to work with buffer or git too.

Any clue or example on how to implement that?

Describe alternatives you've considered.

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions