aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/tmux.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-07-31 17:46:34 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-07-31 17:46:34 +1200
commit8af8a11034816f54dec1332ac43e44320db9cb48 (patch)
treef492eb4eaabbf42d434a2685947d61dbd8f61391 /bash/bashrc.d/tmux.bash
parentTrailing whitespace fixes (diff)
downloaddotfiles-8af8a11034816f54dec1332ac43e44320db9cb48.tar.gz
dotfiles-8af8a11034816f54dec1332ac43e44320db9cb48.zip
Improve comments on shell scripts
Diffstat (limited to 'bash/bashrc.d/tmux.bash')
-rw-r--r--bash/bashrc.d/tmux.bash6
1 files changed, 6 insertions, 0 deletions
diff --git a/bash/bashrc.d/tmux.bash b/bash/bashrc.d/tmux.bash
index ee47e7fc..c7785cd3 100644
--- a/bash/bashrc.d/tmux.bash
+++ b/bash/bashrc.d/tmux.bash
@@ -1,7 +1,13 @@
# Attach to existing tmux session rather than create a new one if possible
tmux() {
+
+ # If any arguments to function, just run tmux as normal with them
if [[ -n "$@" ]]; then
command tmux "$@"
+
+ # If no arguments, attempt to attach to an existing session; if that fails,
+ # run the tmux binary with no arguments, which by default creates a new
+ # session
else
command tmux attach -d &>/dev/null || command tmux
fi