Closed sarojregmi200 closed 1 month ago
After looking at the source code and tinkering with it a little bit. I found out where my configuration was wrong.
set -g @sessionx-custom-paths 'mylocation/Documents/projects/' # to set persisting sessions
Here I specified documents/projects/
with a trailing slash.
And according to the pattern matching in the below code:
https://github.com/omerxx/tmux-sessionx/blob/ac9b0ec219c2e36ce6beb3f900ef852ba8888095/scripts/sessionx.sh#L85C4-L87C6
if [[ $sessions == *"${i##*/}"* ]]; then
continue
It gets converted to:
if [[ $sessions == *""* ]]; then
continue
which skips printing the default sessions that are specified with a trailing /.
Solutions:
basename
instead of pattern matching can be a good alternative.
if [[ $sessions == $(basename $i) ]]; then
I would love to know your thinking of this.
Hey @sarojregmi200 and thank you! Yes, you solution seems at a first glance like a more elegant option, I'm just worried about different shells support for basename. I know bash and fish support it. Do you think it would make any other difference other than solving the trailing slash issue?
Also, I wonder about the backward compatibility of existing users.
If you think both are ok, would you like to open a PR with changes and test it?
Thanks!
I have done some research in bash and it works there but have not tested in other shells. I will submit a pr once I confirm backwards compatibility and shells compatibility.
Thanks you for the plugin, @omerxx.
While setting up tmux-sessionx I wanted to set some options in the session list that are already present without creating any session. So, that it's easy to just navigate to those locations while creating a new session.
The config option for what I want is present here: https://github.com/omerxx/tmux-sessionx/blob/ac9b0ec219c2e36ce6beb3f900ef852ba8888095/README.md?plain=1#L41C1-L44C74
My implementation:
But I donot see the projects path in my list of sessions. Am I missing something?