-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Buffer with this name already exists #1365
Comments
Please revise your config. I think you pasted neo-tree config twice. Also please update the issue title like other issues. |
Thanks @pysan3, that was fast! Hopefully all is clear now. |
I am also seeing this issue. I am simply using LazyVim without any modifications to the neo-tree configuration and the auto-session plugin with the following configuration. return {
"rmagatti/auto-session",
config = function()
require("auto-session").setup({
auto_session_last_session_dir = vim.fn.stdpath("data") .. "/sessions/",
auto_session_root_dir = vim.fn.stdpath("data") .. "/sessions/",
auto_session_enabled = true,
log_level = vim.log.levels.ERROR,
auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
auto_save_enabled = true,
auto_session_create_enabled = true,
session_lens = {
buftypes_to_ignore = {},
load_on_setup = true,
theme_conf = { border = true },
previewer = false,
},
})
vim.keymap.set("n", "<leader>ls", require("auto-session.session-lens").search_session, {
noremap = true,
})
end,
} I have also seen other issues where if I use the AutoSessions does have an example of how to make it work with local function restore_nvim_tree()
local nvim_tree = require('nvim-tree')
nvim_tree.change_dir(vim.fn.getcwd())
nvim_tree.refresh()
end
require('auto-session').setup {
pre_restore_cmds = {restore_nvim_tree}
} |
Could you test this option and see if it works? |
Thanks @pysan3, adding Basically what happens now is - if neo-tree was open in previous sessions, after reopening nvim its pane gets simply closed (this can be seen in action for a split second). It would be nice to still keep the neo-tree open if that was the case in the previous session, however I'm ok with this solution for now, I guess next step would be to explore |
@SparrowMike Thanks for testing! Unfortunately no, there is no way to auto-restore neo-tree state since we can adjust the position (left, right etc) and source (filesystem, buffers etc) dynamically, we cannot tell which and where neo-tree was with only the buffer name (and this is the only clue autosession will restore for us). Spoiler alert, I will make it possible with the new re-write. |
EDIT: please see #1366 (comment) instead. Below is old info so plz ignore. Nah just do it now lol. Could you test it out? @SparrowMike return {
"pysan3/neo-tree.nvim",
branch = "restore-session-experimental",
version = false,
opts = {
auto_restore_session_experimental = true,
-- ... Caution: You need to have For the case of vimscript, Caution2: It will be wonky (or not work at all) when you set the default neo-tree position to float or current. Caution3: If you had more than one neo-tree sources opened, only one of them will be respected, with filesystem being most prioritized. |
Thanks @pysan3 for going extra mile, I followed all the steps as described however the results are the same. I will give it another go on my other machine at home, will let you know if results are different. cheers! |
I am still seeing quite a few issues here, I am attaching a screen recording. Notice that sometimes neo-tree opens full screen, other times it opens but the cwd is from the previous project. Also notice there are tabs open for the session directory and sometimes This is my config for neo-tree, outside of using the default implementation from return {
"nvim-neo-tree/neo-tree.nvim",
opts = {
auto_clean_after_session_restore = false,
},
} This is my auto-session configuration return {
"rmagatti/auto-session",
config = function()
require("auto-session").setup({
auto_session_last_session_dir = vim.fn.stdpath("data") .. "/sessions/",
auto_session_root_dir = vim.fn.stdpath("data") .. "/sessions/",
auto_session_enabled = true,
log_level = vim.log.levels.ERROR,
auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
auto_save_enabled = true,
auto_session_create_enabled = true,
session_lens = {
buftypes_to_ignore = {},
load_on_setup = true,
theme_conf = { border = true },
previewer = false,
},
})
vim.keymap.set("n", "<leader>ls", require("auto-session.session-lens").search_session, {
noremap = true,
})
end,
} |
Screen.Recording.2024-02-28.at.9.16.04.AM.mp4 |
Thanks for testing but you should switch the repo to my fork and change the branch name. You are testing nothing as this has not yet landed to neo-tree's main branch... return {
"pysan3/neo-tree.nvim",
branch = "restore-session-experimental",
version = false,
opts = {
auto_restore_session_experimental = true,
-- ... And could you move a bit more slowly, or please describe what you are doing. Your screen capture is just flashing and constantly moving that I cannot tell what and what not you are testing... |
May I ask you to give me your feedbacks in this thread next time? |
@pysan3 apologies, I will use that thread from now on. I will also make a new screen recording slowing things down so that you can see what i am doing. I will also test using your fork and branch |
Did you check docs and existing issues?
Neovim Version (nvim -v)
NVIM v0.9.5
Operating System / Version
macOS - 14.2.1
Describe the Bug
When loading into a previous session that had neo-tree enabled I simply get the a blank window, whenever I toggle the neo-tree I get another blank window followed by a error:
[Neo-tree ERROR] debounce filesystem_navigate error: ...are/nvim/lazy/neo-tree.nvim/lua/neo-tree/ui/renderer.lua:1045: Vim:E95: Buffer with this name already exists
I believe the issue has something to do with
auto-sessions
as disabling it makes the problem go away.Screenshots, Traceback
The first image is loading into a session and the blank window on the right is what I think should be the neo-tree
At the bottom of the screen the error can be seen - it was triggered by the hotkey that I used to enable the neo-tree window, there is also an additional window, I believe this is where neo-tree tries to load into but its buffer already exists?
Steps to Reproduce
Expected Behavior
No errors?
Your Configuration
The text was updated successfully, but these errors were encountered: