commit 9b165ccad5d02ccfd89de932b6fe3aa5480b61ec parent 8590a1f86aff0fec62f97cbf2374fbdcd0289fce Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Thu, 9 Apr 2020 07:48:36 +0200 Condense code for tsplit() Diffstat:
M | .profile | | | 20 | ++++++++------------ |
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/.profile b/.profile @@ -103,19 +103,15 @@ tsplit() { echo "error: not in tmux session" >&2 return 1 fi - if [ $# -gt 0 ]; then - if [ "$1" = "j" ]; then - tmux split-pane -v -c "$PWD" - elif [ "$1" = "l" ]; then - tmux split-pane -h -c "$PWD" - elif [ "$1" = "w" ]; then - tmux new-window -c "$PWD" - else - echo "error: split direction not understood" >&2 - return 2 - fi + if [ $# -eq 0 ] || [ "$1" = "l" ]; then + tmux split-pane -h -c "$PWD" + elif [ "$1" = "j" ]; then + tmux split-pane -v -c "$PWD" + elif [ "$1" = "w" ]; then + tmux new-window -c "$PWD" else - tmux split-pane -h -c $PWD + echo "error: split direction not understood" >&2 + return 2 fi }