joshmedeski / sesh

Smart session manager for the terminal
MIT License
410 stars 16 forks source link

Allow `session_path` to be configured with wildcards (e.g. `~/projects/project-*` or `~/projects/*`) #80

Closed wbeeftink closed 4 months ago

wbeeftink commented 4 months ago

What would you like sesh to do?

I would like session_path to allow wildcards so I can use the same script_path for similar projects.

I have several projects where I typically like to open a few windows (code, server, tests, zsh). What I do now, is define a startup script per project pointing to the same script_path.

[[startup_scripts]]
script_path = "~/.config/sesh/scripts/project"
session_path = "~/projects/project-1"

[[startup_scripts]]
script_path = "~/.config/sesh/scripts/project"
session_path = "~/projects/project-2"

With a wildcard this could be reduced to something like this:

[[startup_scripts]]
script_path = "~/.config/sesh/scripts/project"
session_path = "~/projects/project-*"

Or something like this?

[[startup_scripts]]
script_path = "~/.config/sesh/scripts/project"
session_path = "~/projects/*"

Apologies if this is already possible and I missed something in the docs.

For reference, this is what my startup script contains:

#!/usr/bin/env bash
# vi: ft=sh

tmux rename-window "code"
tmux new-window -n "server"
tmux new-window -n "tests"
tmux new-window
tmux select-window -t 1
nvim -c "Telescope find_files"
joshmedeski commented 4 months ago

Great idea! It was a quick update, download v0.15.0 and let me know how it works for you.

wbeeftink commented 4 months ago

Awesome, works exactly as advertised. I wasn't sure if foo* would also match just foo but it does.

E.g. I have these projects:

~/projects/project
~/projects/project-foo

Both are matched nicely with the config below:

[[startup_scripts]]
script_path = "~/.config/sesh/scripts/project"
session_path = "~/projects/project*"

Cheers for the change!