aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorNicholas Noll <nnoll523@gmail.com>2020-06-20 21:04:14 -0700
committerNicholas Noll <nnoll523@gmail.com>2020-06-20 21:04:14 -0700
commit641ea1557ccc0099ef5471a16503938bd00924af (patch)
tree249ca7c822162099b04936af7c2526c23be7ba1b /bin
parente12e88483cc0a2dbdc2b6ff6a3c45750cfc17d1e (diff)
larger fonts for laptop
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tmux-send37
1 files changed, 37 insertions, 0 deletions
diff --git a/bin/tmux-send b/bin/tmux-send
new file mode 100755
index 0000000..47a6de8
--- /dev/null
+++ b/bin/tmux-send
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+dir=$1
+tty=$(tmux list-panes -F "#{pane_active}#{pane_tty}" | grep '^1' | cut -c2-)
+vim=$(ps -o stat=,command= -t $tty | awk 'BEGIN{flag=0} {if($1 ~ /S*+/ && $2 ~ /nvim/){flag +=1}}; END {print flag}')
+
+if [ $vim -gt 0 ]; then
+ case $dir in
+ up)
+ tmux send-keys C-k
+ ;;
+ down)
+ tmux send-keys C-j
+ ;;
+ left)
+ tmux send-keys C-h
+ ;;
+ right)
+ tmux send-keys C-l
+ ;;
+ esac
+else
+ case $dir in
+ up)
+ tmux select-pane -U
+ ;;
+ down)
+ tmux select-pane -D
+ ;;
+ left)
+ tmux select-pane -L
+ ;;
+ right)
+ tmux select-pane -R
+ ;;
+ esac
+fi