diff options
| -rw-r--r-- | bash/.bash_aliases | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bash/.bash_aliases b/bash/.bash_aliases index ff655bc..3693bf5 100644 --- a/bash/.bash_aliases +++ b/bash/.bash_aliases @@ -14,3 +14,17 @@ alias gl='git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short' # Nixos alias ras='sudo nixos-rebuild switch --flake .#' + +# Tmux +tm() { + if [ -n "$1" ]; then + # If an argument is provided, try to attach to it or create it. + tmux attach-session -t "$1" 2>/dev/null || tmux new-session -s "$1" + elif tmux has-session 2>/dev/null; then + # No argument? Open the alphabetical list. + tmux attach-session \; choose-tree -sZ -O name + else + # Nothing running? Fresh start. + tmux + fi +} |
