Skip to content

Instantly share code, notes, and snippets.

@edrpls
Created March 20, 2018 04:31
Show Gist options
  • Save edrpls/15dcba3e3f82d392907398e3f1a9e179 to your computer and use it in GitHub Desktop.
Save edrpls/15dcba3e3f82d392907398e3f1a9e179 to your computer and use it in GitHub Desktop.
tmux on antergos
set -sg escape-time 0
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
bind -n C-h run "($is_vim && tmux send-keys C-h) || \
tmux select-pane -L"
bind -n C-j run "($is_vim && tmux send-keys C-j) || \
($is_fzf && tmux send-keys C-j) || \
tmux select-pane -D"
bind -n C-k run "($is_vim && tmux send-keys C-k) || \
($is_fzf && tmux send-keys C-k) || \
tmux select-pane -U"
bind -n C-l run "($is_vim && tmux send-keys C-l) || \
tmux select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind C-l send-keys 'C-l'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment