This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set prefix to Ctrl-Space instead of Ctrl-b | |
unbind C-b | |
set -g prefix C-n | |
bind n send-prefix | |
# See (and comments): https://stackoverflow.com/a/42461580/3943054 | |
bind -n S-Enter send-keys Escape "[13;2u" | |
bind -n C-Enter send-keys Escape "[13;5u" | |
# split panes using | and _ | |
bind | split-window -h | |
bind _ split-window -v | |
unbind '"' | |
unbind % | |
bind q killp | |
set-window-option -g mode-keys vi | |
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 y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard' | |
# switch panes using Alt-arrow without prefix | |
bind -n ˙ select-pane -L | |
bind -n ¬ select-pane -R | |
bind -n ˚ select-pane -U | |
bind -n ∆ select-pane -D | |
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | |
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | |
# bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" | |
# bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" | |
# bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" | |
# bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" | |
# Smart pane switching with awareness of vim and fzf | |
forward_programs="view|n?vim?|fzf" | |
should_forward="ps -o state= -o comm= -t '#{pane_tty}' \ | |
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?($forward_programs)(diff)?$'" | |
bind -n C-h if-shell "$should_forward" "send-keys C-h" "select-pane -L" | |
bind -n C-j if-shell "$should_forward" "send-keys C-j" "select-pane -D" | |
bind -n C-k if-shell "$should_forward" "send-keys C-k" "select-pane -U" | |
bind -n C-l if-shell "$should_forward" "send-keys C-l" "select-pane -R" | |
bind -n C-\\ if-shell "$should_forward" "send-keys C-\\" "select-pane -l" | |
set -g mouse on | |
set-option -gw xterm-keys on | |
bind C-Tab next-window | |
bind C-S-Tab previous-window | |
# address vim mode switching delay (http://superuser.com/a/252717/65504) | |
set -s escape-time 0 | |
# increase scrollback buffer size | |
set -g history-limit 50000 | |
# tmux messages are displayed for 4 seconds | |
set -g display-time 2000 | |
# upgrade $TERM | |
set -g default-terminal "screen-256color" | |
# focus events enabled for terminals that support them | |
set -g focus-events on | |
# super useful when using "grouped sessions" and multi-monitor setup | |
setw -g aggressive-resize on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment