-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Unify session selection logic, Fixes #287 #315
Conversation
Unify the session loading logic between Telesecop session-lens and AutoSession search so that we always use the session file to load the session (vs relying on changing directory). Set a flag to make sure cwd_change_handling (if enabled) doesn't also try to restore the session This also fixes a session load failure when a session with a git branch name is selected from Telescope session-lens or Autosession search. Removed the non-functional (as far as I can see) code for buftypes_to_ignore. That code would not bwipeout a buffer if it matched but the buffers get wiped out by the sourcing the session file anyway and having that code generates an error when the buffer is opened in another process which interrupts the session swap. Made the option deprecated and asked anyone using it to report it on GH.
Also fixes #314 |
The session check works as follows: For each session file, first check that it's not a directory. Then check if it ends in x.vim. If it doesn't, then return true. If it does, if the first line contains the word "SessionLoad" then return true and false otherwise. This will include valid session files that happen to end in x and not include the *x.vim session files neovim creates for custom user commands saved with the session.
Just added a fix for #295 as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, just a comment on path joining regarding Windows users 🙏
Will have to look at other uses of '/' at a later time
Should be all set now. thanks! |
Is these PR will fix this? Thanks very much. Seems now it is a proper time to fix this. |
@tan-wei Yes, this should fix loading a git session from either |
Wow, great! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great now, thanks again for the work put into this 🤜🤛
Great. Seems all works well now!!! |
Unify the session loading logic between Telesecop session-lens and AutoSession search so that we always use the session file to load the session (vs relying on changing directory). Set a flag to make sure cwd_change_handling (if enabled) doesn't also try to restore the session This also fixes a session load failure when a session with a git branch name is selected from Telescope session-lens or Autosession search.
Removed the non-functional (as far as I can see) code for buftypes_to_ignore. That code would not bwipeout a buffer if it matched but the buffers get wiped out by the sourcing the session file anyway and having that code generates an error when the buffer is opened in another process which interrupts the session swap. Made the option deprecated and asked anyone using it to report it on GH.