Skip to content
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

Args support #320

Merged
merged 6 commits into from
Jul 8, 2024
Merged

Args support #320

merged 6 commits into from
Jul 8, 2024

Conversation

cameronr
Copy link
Collaborator

@cameronr cameronr commented Jul 8, 2024

Introduces two new arguments:

args_allow_single_directory (default: true)
Allows launching nvim with single a argument that's a directory.
auto-session will try to load a session from that directory if possible

args_files_auto_save (default false)
Allow saving a session even when launched with a file argument (or
multiple files/dirs). It does not load any existing session first.
That's not super useful on it's own by args_files_auto_save can be a
callback function that conditionally returns true or false

Fixes #303 #316

cameronr and others added 6 commits July 5, 2024 00:01
Add args_handling config option to control how args are handled:

replace_session: don't load existing session but save on exit

replace_session_only_if_multiple_buffers: don't load existing session
but if there is more than one buffer that would be saved, then save on
exit

new_session_named_with_args: not implemented, may create too many
sessions and may not be worth it
If nvim is launched with a single, directory then try to load a session
from that directory (factoring in all of the other rules).

We make sure to temporarily disable cwd_change_handling if enabled as
restoring the session will change the cwd in this case:x
Got tripped up by 0 being true in Lua. Would cause any single argument
to be treated as a directory to load a session from

Also annoated another suspected bug on line 384 but not traced through
at this time
Introduces two new arguments:

args_allow_single_directory (default: true)
Allows launching nvim with single a argument that's a directory.
auto-session will try to load a session from that directory if possible

args_files_auto_save (default false)
Allow saving a session even when launched with a file argument (or
multiple files/dirs). It does not load any existing session first.
That's not super useful on it's own by args_files_auto_save can be a
callback function that conditionally returns true or false
Copy link
Owner

@rmagatti rmagatti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! 🎉

@rmagatti rmagatti merged commit 04e1db5 into rmagatti:main Jul 8, 2024
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.

[FEATURE]
2 participants