omerxx / tmux-sessionx

A Tmux session manager, with preview, fuzzy finding, and MORE
GNU General Public License v3.0
554 stars 51 forks source link

Better handling of Zoxide Index for Session Creation #116

Closed Msouza91 closed 1 week ago

Msouza91 commented 4 weeks ago

Feature suggestion about how new sessions are handled here, might be just nitpicking on my part, but hear me out.

When I type in some part of a directory name that I know to be on my Zoxide history creating a session just with that part of the name might result into non descriptive names for the sessions and create some friction on having to rename said sessions, so in those cases a better approach would be using the full name of the directory instead for the session name, although a bit naive maybe but I think it should cover most cases.

Another option (inspired on Josh Medeski's plugin) would be instead of having this automatic session creation, have a binding similar to ^-x to open an fzf search on the zoxide index in which you could select the directory you want with precision and create a session with the directory name.

omerxx commented 3 weeks ago

Interesting!

  1. Are you suggesting sending the result to zoxide only after comparing it to the list of available options and then using the full name from the DB?
  2. Regarding your other option, while I can't really pop another window as I'm locked to fzf which in turn is locked to a tmux popup, I can use the preview panel to show zoxide results! This can be an interesting direction. Is that close to what you had in mind?

One note though - only displaying results from zoxide, even if possible, still doesn't give me the option to pick them. Perhaps I should load them into the dictionary feeding fzf on the fly. Not even sure that's possible I'm thinking out loud.

LMK what are you thoughts

pinbraerts commented 2 weeks ago

One note though - only displaying results from zoxide, even if possible, still doesn't give me the option to pick them.

It should be working. Take a look at my dotfiles. I was using it on a daily basis and now am migrating to tpm+sessionx

Also I noticed that zoxide sessions are created with a window with a specific name. https://github.com/omerxx/tmux-sessionx/blob/56abffd0155805f8165fb5af19c50d04c4a49069/scripts/sessionx.sh#L136

I think it would be better to take more atomic approach and have a single universal new-session with some default parameters and escaping like basename + replacing '.' character (switching to a session with '.' in name breaks tmux). It would make easier to allow user to control session creation

pinbraerts commented 2 weeks ago

Also I think the best approach here would be to allow any user command for input

omerxx commented 1 week ago

Also I think the best approach here would be to allow any user command for input

I merged the PR adding the solution to this, however I do agree that some people may want to tweak the zoxide command. Feel free to reopen if you think it's necessary