Skip to content

Use noe-tree api commands outside of config mappings? #763

Answered by cseickel
JoseConseco asked this question in Q&A
Discussion options

You must be logged in to vote

On the one hand, you already have the state part figured out with:

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

which will work fine for a sidebar style file system tree.

The extra config argument that is added can just be an empty table if you don't want to use any configuration. That means all you need to do to make the example work is to append

state.config = {}

You should really do that on every command invocation instead of treating state like a global variable. I would create a function like this:

local build_command = function(command_name)
  local fn = function()
    local cmds = require("neo-tree.sources.filesystem.commands")
    local state = require("

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@JoseConseco
Comment options

@miversen33
Comment options

@JoseConseco
Comment options

@miversen33
Comment options

@JoseConseco
Comment options

Comment options

You must be logged in to vote
2 replies
@JoseConseco
Comment options

@cseickel
Comment options

Answer selected by cseickel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants