Replies: 2 comments 1 reply
-
|
I think this works: |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
I tried both examples, but neither gave me expected behaviour, {
"<leader>r",
function()
require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd(), reveal = true })
local state = require("neo-tree.sources.manager").get_state_for_window()
require("neo-tree.sources." .. state.name .. ".commands")["preview"](state)
-- vim.defer_fn(function()
-- local state = require("neo-tree.sources.manager").get_state_for_window()
-- assert(state)
-- state.commands.preview(state)
-- end, 1000)
end,
desc = "Explorer NeoTree (Root Dir)",
remap = true,
},but it fails.
and
Im looking for a way to make a preview on constantly, did anyone solve it? calling the same code form actions works well, e.g.: ["<esc>"] = {
function(state)
require("neo-tree.sources." .. state.name .. ".commands")["revert_preview"](state)
require("neo-tree.sources." .. state.name .. ".commands")["cancel"](state)
end,
desc = "close preview and floating tree window",
}, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I would want to add some custom action to execute while neo-tree buffer is active. Not a mapping, rather for example to create a file when a menu item in the right mouse click menu is selected.
The
mappins = {has many actions. How do I call these actions to do from a lua function to do in the context currently selected under the cursor inside neo-tree window?For example in nvimtree I can do
local api = require "nvim-tree.api"local node = api.tree.get_node_under_cursorapi.fs.create(node()). How to do that in neo-tree?There is execute https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/lua/neo-tree/command/init.lua#L46 but it only hides or shows, and it's for when neo-tree is not in focus. Neo-tree will be in focus.
There are commands https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/lua/neo-tree/sources/common/commands.lua#L107 , but how do I get the current state?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions