Created
January 13, 2013 17:26
-
-
Save mislav/4525198 to your computer and use it in GitHub Desktop.
A jump-to-session tmux shortcut. With `<prefix> S` a prompt is shown to enter a session name. If no name is given, switches back to the previously attached session. Session name can be a partial string that the session starts with, as long as it's unique.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
if [[ -z $1 ]]; then | |
tmux switch-client -l | |
else | |
tmux switch-client -t "$1" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# switch to a session that start with the given name | |
bind S command-prompt -p session: "run-shell 'tmux-switch-session \"%%\"'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for posting this, I incorporated the idea into a script that allows one to switch to / attach / create a given session easily: https://github.com/faceleg/dotfiles/blob/master/addons/tmux/scripts/switch-create-attach.sh