Skip to content
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

fix: tab-scoped cwd not being set #21

Merged
merged 2 commits into from
Aug 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions lua/resession/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ M.load = function(name, opts)
if not data.tab_scoped then
-- Set the options immediately
util.restore_global_options(data.global.options)
vim.cmd(string.format("cd %s", data.global.cwd))
end
local scale = {
vim.o.columns / data.global.width,
Expand Down Expand Up @@ -470,6 +469,11 @@ M.load = function(name, opts)
util.restore_buf_options(bufnr, buf.options)
end

-- Ensure the cwd is set correctly for each loaded buffer
if not data.tab_scoped then
vim.api.nvim_set_current_dir(data.global.cwd)
end

local curwin
for i, tab in ipairs(data.tabs) do
if i > 1 then
Expand All @@ -490,11 +494,6 @@ M.load = function(name, opts)
end
end

-- Ensure the cwd is set correctly for each loaded buffer
if not data.tab_scoped then
vim.api.nvim_set_current_dir(data.global.cwd)
end

-- This can be nil if we saved a session in a window with an unsupported buffer
if curwin then
vim.api.nvim_set_current_win(curwin)
Expand Down