When I restore a session with resession.nvim which in turn changes the current working directory (:pwd), neo-tree doesn't reflect the new current working directory when I open it if it was previously open
Screenshots, Traceback
This shows Neo-tree opened not in the current working directory which is displayed in the bottom when I run :pwd
Steps to Reproduce
create a directory with the repro.lua file
mkdir test, make a directory in there as a "scratch directory
echo "SESSION LOADED" > test/test, make an example file
nvim -u repro.lua, start up neovim
:cd test, change directory into the test directory
:e test, open our example file
:lua require("resession").save("Test"), save a session
:q, quit neovim
nvim -u repro.lua, start up neovim again
:Neotree, open neo-tree and see that we are in our repro folder
:pwd, check the current working directory and see that it is in our test/ folder
:Neotree, open neo-tree and see that it has us in our repro folder and not in the test/ folder
:pwd, check the current working directory even in our Neo-tree buffer and see that it has us in the test/ directory
Expected Behavior
Neo-tree should be following the current working directory no matter what. I'm not sure what would be causing this issue. My initial thought is the issue is on the neo-tree side just because neo-tree should be respecting the current working directory no matter what. Please let me know if I can provide any other information to help debug this!
Your Configuration
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
},
opts = {},
},
{
"stevearc/resession.nvim",
opts = {},
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Did you check docs and existing issues?
Neovim Version (nvim -v)
0.10.0 Release
Operating System / Version
Arch Linux
Describe the Bug
When I restore a session with resession.nvim which in turn changes the current working directory (
:pwd
), neo-tree doesn't reflect the new current working directory when I open it if it was previously openScreenshots, Traceback
This shows Neo-tree opened not in the current working directory which is displayed in the bottom when I run
:pwd
Steps to Reproduce
repro.lua
filemkdir test
, make a directory in there as a "scratch directoryecho "SESSION LOADED" > test/test
, make an example filenvim -u repro.lua
, start up neovim:cd test
, change directory into thetest
directory:e test
, open our example file:lua require("resession").save("Test")
, save a session:q
, quit neovimnvim -u repro.lua
, start up neovim again:Neotree
, open neo-tree and see that we are in our repro folderq
, close neo-tree:lua require("resession").load("Test")
, load our session:pwd
, check the current working directory and see that it is in ourtest/
folder:Neotree
, open neo-tree and see that it has us in our repro folder and not in thetest/
folder:pwd
, check the current working directory even in our Neo-tree buffer and see that it has us in thetest/
directoryExpected Behavior
Neo-tree should be following the current working directory no matter what. I'm not sure what would be causing this issue. My initial thought is the issue is on the neo-tree side just because neo-tree should be respecting the current working directory no matter what. Please let me know if I can provide any other information to help debug this!
Your Configuration