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

Thoughts on new features #59

Closed
josh-nz opened this issue Jun 3, 2024 · 9 comments
Closed

Thoughts on new features #59

josh-nz opened this issue Jun 3, 2024 · 9 comments

Comments

@josh-nz
Copy link
Contributor

josh-nz commented Jun 3, 2024

I've been looking for a sesssion manager that does what I want but haven't yet found an ideal one. This project is appealing because of the use of JSON and so the possibility to save additional data, but it's lacking some features I would like. The purpose of this issue is to outline features I'd like to (try) and add, and see if they are a good fit or would be accepted, before I start too much work on them.

  1. I'd like it to automatically restore the last used session based on the CWD, not the last used session. It seems others also would like this, Auto-restore based on CWD #45, and URL-encoded session names #55 might help towards this, but I think it has some current issues I'll discuss over there. I think for this to be a feature, there needs to be consideration of what to do with the existing behaviour of loading the last session, which some might wish to retain. Edit: this feature looks almost ready from URL-encoded session names #55, great stuff.

I actually think that this is the bare minimum to make this more useful to me. There are some further enhancements that might be nice:

  1. The current auto save tmp is limited to a single session. It might be useful to have this per CWD. Edit: looks to be implemented by URL-encoded session names #55

  2. Related to 2, I think I'd prefer the auto session save to not happen every CWD, but only in certain folders (notably those with a .git folder present). [Current workaround: manually save a session on start up, and then the auto cwd load from 1. above (when implemented) will always restore it]. Edit: This looks to be doable via the fun(): boolean option to cwd autosave. Nice!

  3. Some integration with git branch names might be nice, but I'm not currently using Neovim enough in this context to have strong opinions on how exactly this should work.

Some other more minor issues I've noticed that I'd like to look at:

  • tmp session file will overwrite each other if 2 vim instances are running. I'm not actually sure what to do about this issue at present. A tmp file per CWD might be enough to avoid most issues here.

  • __last__ symlink will point to invalid file if session is removed via telescope. I think there is a better way to ascertain the last session than by using symlinks (idea stolen from nvim.possession), which removes some complexity. A similar method can probably used to help implement 1.

  • when trying to save session, if no session is open, prompt for name instead of displaying error if no name is initially provided.

I can make separate issues for the minor issues as I work on them, if desired.

@josh-nz
Copy link
Contributor Author

josh-nz commented Jun 3, 2024

I think a good chunk of what I was hoping to do has already by done after looking at #55 in more detail. I'll focus instead on the smaller issues I've noticed.

Thanks @jedrzejboczar and @awerebea for all your effort!

@josh-nz
Copy link
Contributor Author

josh-nz commented Jun 3, 2024

A proposed extension to the load last CWD session feature; instead of just matching CWD to session filename, find the most recent session for the CWD based on the CWD inside the JSON, ignoring filename. This will allow for custom named sessions to also support the load last CWD session feature.

@jedrzejboczar
Copy link
Owner

Thanks for detailed suggestions! As for 4. I described some potential initial implementation in #17 but this would need more work. As for the minor ones not related to #55, they are valid issues that we may want to address, but it's probably better to focus on #55 first and then we can revisit those.

@Kruziikrel13
Copy link

Another suggestion!

Session Autoload should not run if command line arguments were passed specifying a file/s or directory.

@josh-nz
Copy link
Contributor Author

josh-nz commented Jun 21, 2024

I agree. There a number of changes to autoload currently being worked on as part of #63. I'll have a look at the current behaviour and make adjustments as needed.

Thanks for the reminder on this.

@josh-nz
Copy link
Contributor Author

josh-nz commented Jun 23, 2024

@Kruziikrel13 to be clear on your suggestion, if you pass a folder to Neovim on the command line, and a session exists for that directory, you would expect the session to NOT autoload?

It definitely shouldn't if you pass just files, but what about a single directory? Could you explain why you think it should not autoload, or your use case? It would be helpful to know people's perspectives on this behaviour.

@jedrzejboczar
Copy link
Owner

Imo it should not autoload if you pass anything, regardless if it's file or directory. I often pass a directory to start neovim and open the directory listing in oil.nvim (some use netrw). Basically, I feel like it should work like startup screens (alpha.nvim, dashboard.nvim) that only open if you don't pass anything on the command line.

@josh-nz
Copy link
Contributor Author

josh-nz commented Jun 23, 2024

Sounds good, let's go with that. It matches what @Kruziikrel13 suggested, and it's also the simplest implementation. Passing args to Neovim is not a use case of mine, so I have no real solid opinions either way.

@josh-nz josh-nz closed this as completed Jun 25, 2024
@josh-nz
Copy link
Contributor Author

josh-nz commented Jun 25, 2024

Completed in #63

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

No branches or pull requests

3 participants