-
-
Notifications
You must be signed in to change notification settings - Fork 53
[Feature] Track current session without relying on vim.v.this_session
in current_session_name
#250
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
Comments
Hey, you are correct. This likely happens because Meaning this implementation would still return the same value regardless of the session file being deleted or not: function Lib.current_session_name()
local fname = Lib.get_file_name(vim.v.this_session)
local extension = Lib.get_file_extension(fname)
local fname_without_extension = fname:gsub(extension:gsub("%.", "%%%.") .. "$", "")
local fname_split = vim.split(fname_without_extension, "%%")
local session_name = fname_split[#fname_split] or ""
return session_name
end |
So, is this an intended behavior? I've thought that this is a bug 🤔 |
Not necessarily but ultimately the current session is still the one that was previously loaded according to vim, even after a Another way to go would be to not use |
Much thanks for the detailed info on this topic, I think the issue may either be closed or edited as a feature request as you wish!
Implementation of this feature request probably don't really worth it and may introduce unnecessary complications, but I'm really not you to make conclusions :) In my opinion, for a proper solution, I should forward this to main vim/nvim repos. Thank you again! |
current_session_name
is not updated after session deletionvim.v.this_session
in current_session_name
It looks like :lua vim.v.this_session = 'test'; print(vim.v.this_session) So i think it makes sense to clear it when if the current session is deleted. |
Describe the bug
I'm using
auto-session
withlualine
integration:It seems that after deleting a session with
SessionDelete
, current session name is not updated (re-openingnvim
required)To Reproduce
Steps to reproduce the behavior:
:SessionSave
and see it immediately reflected onlualine
lualine
Expected behavior
Session name should be updated
Screenshots
If applicable, add screenshots to help explain your problem.
Baseline (please complete the following information):
set sessionoptions?
: sessionoptions=blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptionsuname -a
: Darwin Benos-MacBook-Air.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:52 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T8103 arm64nvim --version
NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3
The text was updated successfully, but these errors were encountered: