# tmux_binds.conf

# Binds
bind-key 'x' kill-pane
bind-key 'h' previous-window
bind-key 'j' switch-client -p
bind-key 'k' switch-client -n
bind-key 'l' next-window
bind-key 'n' new-window -c '#{pane_current_path}'
bind-key 'N' new-window
bind-key 'c' kill-window

# Decide whether we're in a Vim process
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"

unbind y
bind-key 'y' if-shell "$is_vim" 'send-keys F5' 'select-pane -L'
unbind u
bind-key 'u' if-shell "$is_vim" 'send-keys F6' 'select-pane -D'
unbind i
bind-key 'i' if-shell "$is_vim" 'send-keys F7' 'select-pane -U'
unbind o
bind-key 'o' if-shell "$is_vim" 'send-keys F8' 'select-pane -R'

# Tmus sessionizer
unbind s
bind-key 's' display-popup -E -w 90% -h 90% "~/.local/bin/tms"

#Lazygit
unbind g
bind-key 'g' display-popup -d '#{pane_current_path}' -E -w 90% -h 90% "lazygit"
