function __tmux-maybe-create \ --description "Create a tmux session with sensible defaults if it doesn't exist yet" ### Arguments: set session_name $argv[1] set session_dir $argv[2] if pgrep tmux 2>&1 >/dev/null; or ! tmux has -t=$session_name 2>/dev/null # Note: # Maybe it can be interesting to read from an envvar of array, where each element is a call back tmux new-session -ds $session_name -c $session_dir end end