Skip to content

Commit

Permalink
fix: also check for vim.g.SessionLoad in cwd handling
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronr committed Jul 22, 2024
1 parent 0fb8828 commit 8336407
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lua/auto-session/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ M.setup_autocmds = function(config, AutoSession)
return
end

if AutoSession.restore_in_progress then
Lib.logger.debug "DirChangedPre: restore_in_progress is true, ignoring this event"
if AutoSession.restore_in_progress or vim.g.SessionLoad then
Lib.logger.debug "DirChangedPre: restore_in_progress/vim.g.SessionLoad is true, ignoring this event"
-- NOTE: We don't call the cwd_changed_hook here
-- I think that's probably the right choice because I assume that event is mostly
-- for preparing sessions for save/restoring but we don't want to do that when we're
Expand Down Expand Up @@ -62,12 +62,12 @@ M.setup_autocmds = function(config, AutoSession)
return
end

if AutoSession.restore_in_progress then
if AutoSession.restore_in_progress or vim.g.SessionLoad then
-- NOTE: We don't call the cwd_changed_hook here (or in the other case below)
-- I think that's probably the right choice because I assume that event is mostly
-- for preparing sessions for save/restoring but we don't want to do that when we're
-- already restoring a session
Lib.logger.debug "DirChanged: restore_in_progress is true, ignoring this event"
Lib.logger.debug "DirChangedPre: restore_in_progress/vim.g.SessionLoad is true, ignoring this event"
return
end

Expand Down

0 comments on commit 8336407

Please sign in to comment.