Skip to content

Instantly share code, notes, and snippets.

@yury
Created February 13, 2019 13:44
Show Gist options
  • Save yury/84a53925c73e595ec26015604a4aa58d to your computer and use it in GitHub Desktop.
Save yury/84a53925c73e595ec26015604a4aa58d to your computer and use it in GitHub Desktop.
.tmux.conf
set -g default-terminal "tmux-256color"
#set -g default-terminal "screen-256color-bce"
set -sg escape-time 0
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
set -g mouse on
set -g status-position top
set -g set-clipboard on
set -g history-limit 30000
setw -g alternate-screen on
set -g status-left ''
set-window-option -g window-status-current-bg blue
#set-window-option -g window-status-current-format '#I:#W#F[#P]'
#set-window-option -g window-status-format '#I:#W#F'
set -g default-shell $SHELL
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)n?vim(diff)?$|emacs.*$' && tmux send-keys C-l) || tmux select-pane -R"
#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-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'V' send -X select-line
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment