Don't close Neotree buffer when opening a file from "current" or "float" position #1116
Closed
Subjective
started this conversation in
General
Replies: 1 comment 3 replies
-
What about if you marked a set of files with mappings = {
["M"] = function (state)
local node = state.tree:get_node()
if node then
state.clipboard = state.clipboard or {}
local id = node:get_id()
local data = state.clipboard[id]
if data and data.action == "mark" then
state.clipboard[id] = nil
else
state.clipboard[id] = { action = "mark", node = node }
end
require("neo-tree.ui.renderer").redraw(state)
end
end,
["O"] = function (state)
local clipboard = state.clipboard or {}
for id, data in pairs(clipboard) do
if data.action == "mark" then
require("neo-tree.utils").open_file(state, id)
end
end
require("neo-tree.ui.renderer").redraw(state)
end
} |
Beta Was this translation helpful? Give feedback.
3 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.
-
Hi, I'm trying to find implement an
open_nofocus
command, similar to #249. However, I haven't really been able to get it to work satisfactorily withposition=current
orposition=floating
.This is what I'm using right now:
Some context: I'm using
vim.api.nvim_set_current_win(state.winid)
to reset the cursor position to Neotree as I've found that:Neotree reveal
doesn't work as well since it sometimes tries to place the cursor on the file that was just opened after a small time interval, which makes using the command to quickly open multiple files a bit jittery. However, setting the current window doesn't work with Neotree's "current" or "float" positions as it seems like they are always closed no matter what open command I use, so I've been forced to use:Neotree reveal
despite the flickering.I was wondering if there's a better way to open files in a "background" buffer without closing the Neotree buffer? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions