2012-11-12 10:15:43 +08:00
|
|
|
# Ring the bell if any background window rang a bell
|
|
|
|
set -g bell-action any
|
|
|
|
|
|
|
|
# Default termtype. If the rcfile sets $TERM, that overrides this value.
|
|
|
|
set -g default-terminal screen-256color
|
|
|
|
|
|
|
|
# Keep your finger on ctrl, or don't
|
|
|
|
bind-key ^D detach-client
|
|
|
|
|
|
|
|
# Create splits and vertical splits
|
2016-08-20 07:43:29 +08:00
|
|
|
bind-key v split-window -h -p 50 -c "#{pane_current_path}"
|
|
|
|
bind-key ^V split-window -h -p 50 -c "#{pane_current_path}"
|
|
|
|
bind-key s split-window -p 50 -c "#{pane_current_path}"
|
|
|
|
bind-key ^S split-window -p 50 -c "#{pane_current_path}"
|
2012-11-12 10:15:43 +08:00
|
|
|
|
|
|
|
# Pane resize in all four directions using vi bindings.
|
|
|
|
# Can use these raw but I map them to shift-ctrl-<h,j,k,l> in iTerm.
|
2014-08-25 09:54:49 +08:00
|
|
|
bind -r H resize-pane -L 5
|
|
|
|
bind -r J resize-pane -D 5
|
|
|
|
bind -r K resize-pane -U 5
|
|
|
|
bind -r L resize-pane -R 5
|
2012-11-12 10:15:43 +08:00
|
|
|
|
2014-10-25 04:01:18 +08:00
|
|
|
# Smart pane switching with awareness of vim splits.
|
|
|
|
# Source: https://github.com/christoomey/vim-tmux-navigator
|
2017-07-05 20:35:14 +08:00
|
|
|
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
|
|
|
|
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
|
|
|
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
|
|
|
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
|
|
|
|
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
|
2020-04-07 11:33:55 +08:00
|
|
|
|
|
|
|
bind -n C-Left if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
|
|
|
bind -n C-Down if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
|
|
|
bind -n C-Up if-shell "$is_vim" "send-keys C-k" "select-pane -U"
|
|
|
|
bind -n C-Right if-shell "$is_vim" "send-keys C-l" "select-pane -R"
|
|
|
|
|
2020-09-09 04:59:08 +08:00
|
|
|
bind -n 'C-\' if-shell "$is_vim" 'send-keys C-\\' "select-pane -l"
|
2014-10-25 04:01:18 +08:00
|
|
|
|
2012-11-12 10:15:43 +08:00
|
|
|
# Use vi keybindings for tmux commandline input.
|
|
|
|
# Note that to get command mode you need to hit ESC twice...
|
|
|
|
set -g status-keys vi
|
2013-11-16 05:53:34 +08:00
|
|
|
|
2012-11-12 10:15:43 +08:00
|
|
|
# Use vi keybindings in copy and choice modes
|
|
|
|
setw -g mode-keys vi
|
2013-11-16 05:53:34 +08:00
|
|
|
|
2012-11-12 10:15:43 +08:00
|
|
|
# easily toggle synchronization (mnemonic: e is for echo)
|
|
|
|
# sends input to all panes in a given window.
|
|
|
|
bind e setw synchronize-panes on
|
|
|
|
bind E setw synchronize-panes off
|
|
|
|
|
|
|
|
# set first window to index 1 (not 0) to map more to the keyboard layout...
|
2013-08-09 23:37:48 +08:00
|
|
|
set-option -g base-index 1
|
|
|
|
set-window-option -g pane-base-index 1
|
2019-05-18 15:01:40 +08:00
|
|
|
# set-window-option -g mouse on
|
2012-11-12 10:15:43 +08:00
|
|
|
|
|
|
|
# color scheme (styled as vim-powerline)
|
|
|
|
set -g status-left-length 52
|
|
|
|
set -g status-right-length 451
|
2019-05-05 14:28:25 +08:00
|
|
|
set -g status-style fg=white,bg=colour234
|
|
|
|
set -g pane-border-style fg=colour245
|
|
|
|
set -g pane-active-border-style fg=colour39
|
|
|
|
set -g message-style fg=colour16,bg=colour221,bold
|
2012-11-12 10:15:43 +08:00
|
|
|
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]⮀#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]⮀'
|
2022-05-10 23:59:33 +08:00
|
|
|
# set -g window-status-format '#[fg=colour235,bg=colour252,bold] #I #(pwd="#{pane_current_path}"; echo ${pwd####*/}) #W '
|
|
|
|
set -g window-status-format '#[fg=colour235,bg=colour252,bold] #I #W'
|
|
|
|
set -g window-status-current-format '#[fg=colour234,bg=colour59]⮀#[fg=black,bg=colour39,noreverse,bold] #{?window_zoomed_flag,#[fg=colour228],} #I #W #[nobold]#(pwd="#{pane_current_path}"; echo ${pwd####*/}) #[fg=colour39,bg=colour234,nobold]⮀'
|
2017-07-05 20:35:14 +08:00
|
|
|
set-option -g status-interval 2
|
2012-11-12 10:15:43 +08:00
|
|
|
|
|
|
|
# Patch for OS X pbpaste and pbcopy under tmux.
|
2013-12-19 02:16:33 +08:00
|
|
|
set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"
|
2012-11-12 10:15:43 +08:00
|
|
|
|
2017-07-05 20:35:14 +08:00
|
|
|
# Screen like binding
|
|
|
|
unbind C-b
|
|
|
|
set -g prefix C-a
|
|
|
|
bind a send-prefix
|
|
|
|
|
2012-11-12 10:15:43 +08:00
|
|
|
# No escape time for vi mode
|
|
|
|
set -sg escape-time 0
|
|
|
|
|
|
|
|
# Screen like binding for last window
|
|
|
|
unbind l
|
|
|
|
bind C-a last-window
|
|
|
|
|
|
|
|
# Bigger history
|
|
|
|
set -g history-limit 10000
|
2013-11-16 05:53:34 +08:00
|
|
|
|
2014-09-24 15:04:56 +08:00
|
|
|
# New windows/pane in $PWD
|
2016-08-20 07:43:29 +08:00
|
|
|
bind c new-window -c "#{pane_current_path}"
|
2014-09-24 15:04:56 +08:00
|
|
|
|
2015-11-10 09:22:04 +08:00
|
|
|
# Fix key bindings broken in tmux 2.1
|
|
|
|
set -g assume-paste-time 0
|
|
|
|
|
2014-09-24 15:04:56 +08:00
|
|
|
# force a reload of the config file
|
|
|
|
unbind r
|
|
|
|
bind r source-file ~/.tmux.conf \; display "Reloaded!"
|
|
|
|
|
2013-11-16 05:53:34 +08:00
|
|
|
# Local config
|
|
|
|
if-shell "[ -f ~/.tmux.conf.user ]" 'source ~/.tmux.conf.user'
|