Skip to content

Restore previous v:this_session value after writing tmp session file#78

Merged
tpope merged 3 commits intotpope:masterfrom
adizero:master
Dec 2, 2022
Merged

Restore previous v:this_session value after writing tmp session file#78
tpope merged 3 commits intotpope:masterfrom
adizero:master

Conversation

@adizero
Copy link
Contributor

@adizero adizero commented Nov 28, 2022

Fixes a problem with leftover tmp session files. Issue happens after changing/adding buffers/tabs and toggling Obsession (to pause/unpause session tracking). The folder looks like this after a couple of runs (see below, played only with Neovim 0.8). Issue is caused by the mksession call automatically changing the v:this_session variable after writing the tmp session file. Solution is to restore the v:this_session variable after the mksession call.

$ ll Session.vim*
Session.vim.1661.obsession~
Session.vim.1767.obsession~
Session.vim.23502.obsession~
Session.vim.24782.obsession~
Session.vim.24782.obsession~.24782.obsession~.24782.obsession~
Session.vim.24782.obsession~.24782.obsession~.24782.obsession~.24782.obsession~
Session.vim.28396.obsession~
Session.vim.29727.obsession~
Session.vim.31061.obsession~
Session.vim.3134.obsession~
Session.vim.3134.obsession~.3134.obsession~
Session.vim.32691.obsession~
Session.vim.378.obsession~
Session.vim.4539.obsession~

@tpope
Copy link
Owner

tpope commented Nov 28, 2022

The value is already in g:this_obsession. Let's restore from that.

@tpope tpope merged commit fe9d3e1 into tpope:master Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants