blob: 47a6de8029e3dc4ee6a5bcf2dd4bf181d65c59ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
|