Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ set -g @sessionx-bind-fzf-marks 'alt-g'
## [Tmuxinator](https://github.com/tmuxinator/tmuxinator) Integration 🚀

If you want sessionx to detect existing tmuxinator projects, you can set a `sessionx-tmuxinator-mode` in your config (see snippet below).
With Tmuxinator turned 'on' (off by default), the plugin will take a given name and look for a tmuxinator project with that name. If found, it'll **launch the template using tmuxinator**!.
With Tmuxinator turned 'on' (off by default), the plugin will take a given name and look for a tmuxinator project with that name. It will look for local `.tmuxinator.yml` files as well. If found, it'll **launch the template using tmuxinator**!.
There's also a binding to list tmuxinator projects, defaulting to `Ctrl-/`, configurable via:

```bash
Expand Down
44 changes: 27 additions & 17 deletions scripts/sessionx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,36 @@ handle_output() {
exit 0
fi

if ! tmux has-session -t="$target" 2>/dev/null; then
if is_tmuxinator_enabled && is_tmuxinator_template "$target"; then
tmuxinator start "$target"
elif test -n "$mark"; then
tmux new-session -ds "$mark" -c "$target"
target="$mark"
elif test -d "$target"; then
d_target="$(basename "$target" | tr -d '.')"
tmux new-session -ds $d_target -c "$target"
target=$d_target
if tmux has-session -t="$target" 2>/dev/null; then
tmux switch-client -t "$target"
exit 0
fi

name="$target"
if is_tmuxinator_enabled && is_tmuxinator_template "$name"; then
tmuxinator start "$name"
elif test -n "$mark"; then
name="$mark"
elif test -d "$target"; then
name="$(basename "$target" | tr -d '.')"
else
if [[ "$Z_MODE" == "on" ]]; then
target=$(zoxide query "$target")
else
if [[ "$Z_MODE" == "on" ]]; then
z_target=$(zoxide query "$target")
tmux new-session -ds "$target" -c "$z_target" -n "$z_target"
else
tmux new-session -ds "$target"
fi
target=""
fi
fi

if is_tmuxinator_enabled && [ -f "$target/.tmuxinator.yml" ]; then
env -C "$target" tmuxinator local
else
if test -n "$target"; then
tmux new-session -ds "$name" -c "$target"
else
tmux new-session -ds "$name"
fi
tmux switch-client -t "$name"
fi
tmux switch-client -t "$target"

exit 0
}
Expand Down