commit f32f39c2c080aebe0b3467e50ba50835f03de07c parent 6ccba97f2a5231fb15b0ea08d3cb9cddf4c4c3c2 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Mon, 25 Nov 2019 16:02:58 +0100 Add binding to open new tmux split or window in PWD Diffstat:
M | .profile | | | 21 | +++++++++++++++++++++ |
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/.profile b/.profile @@ -121,6 +121,27 @@ alias gl="git log --graph --oneline --decorate --all --color=always | --bind='enter:execute:git show --color=always {2} | less -R' \ --bind='ctrl-x:execute:git checkout {2} .'" +tsplit() { + if [ -z "$TMUX" ]; then + echo "error: not in tmux session" >&2 + return 1 + fi + if [ $# -gt 0 ]; then + if [ "$1" = "v" ]; then + tmux split-pane -v -c "$PWD" + elif [ "$1" = "h" ]; 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 + else + tmux split-pane -h -c $PWD + fi +} + alias w3m="w3m -B" alias w3mtor='torsocks w3m -B "$@"' ddg() {