summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2026-02-02 22:46:50 +0000
committerDavid T. Sadler <davidtsadler@googlemail.com>2026-02-02 22:46:50 +0000
commite76389307556ac84bdcfdf945ed39e7255f32d4b (patch)
treec540101ab2c76f32be0c85f02bb7f798668644ba
parent909cb83f60f61eae9b7dc32577769506ecbe2d7c (diff)
Add tm aliasHEADmain
-rw-r--r--bash/.bash_aliases14
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
+}