diff --git a/README.md b/README.md index ab85dcd..d3b7ad4 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ It's disabled by default, but when enabled it works as follows: - DirChangedPre (before the cwd actually changes): - Save the current session - - Clear all buffers `%bd!`. This guarantees buffers don't bleed to the + - Clear all buffers `%bw!`. This guarantees buffers don't bleed to the next session. - Clear jumps. Also done so there is no bleeding between sessions. - Run the `pre_cwd_changed` hook diff --git a/lua/auto-session/init.lua b/lua/auto-session/init.lua index 65fbed6..a792235 100644 --- a/lua/auto-session/init.lua +++ b/lua/auto-session/init.lua @@ -646,16 +646,16 @@ function AutoSession.RestoreSessionFile(session_path, show_message) AutoSession.restore_in_progress = true -- Clear the buffers and jumps - vim.cmd "%bw!" - vim.cmd "clearjumps" + vim.cmd "silent %bw!" + vim.cmd "silent clearjumps" ---@diagnostic disable-next-line: param-type-mismatch local success, result = pcall(vim.cmd, "silent " .. cmd) -- normal restore failed, source again but with silent! to restore as much as possible if not success and Config.continue_restore_on_error then - vim.cmd "%bw!" - vim.cmd "clearjumps" + vim.cmd "silent %bw!" + vim.cmd "silent clearjumps" -- don't capture return values as we'll use success and result from the first call ---@diagnostic disable-next-line: param-type-mismatch