2016-10-30 06:28:05 -07:00
|
|
|
|
# -- GENERAL -----------------------------
|
2015-12-22 23:20:12 -08:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
set -g default-terminal screen-256color
|
|
|
|
|
set -g default-shell $SHELL
|
|
|
|
|
set -s quiet on
|
|
|
|
|
set -s focus-events on
|
|
|
|
|
# increase scrollback buffer size
|
|
|
|
|
set -g history-limit 10000
|
2015-12-22 00:49:27 -08:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
# Rather than constraining window size to the maximum size of any client
|
|
|
|
|
# connected to the *session*, constrain window size to the maximum size of any
|
|
|
|
|
# client connected to *that window*. Much more reasonable.
|
|
|
|
|
setw -g aggressive-resize off
|
2015-12-16 23:49:22 -08:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
# Tmux >= 2.1
|
|
|
|
|
# enable mouse
|
|
|
|
|
setw -g mouse on
|
|
|
|
|
# fix mouse scrolling: enter copy mode on scroll-up, exits it when scrolled to bottom
|
|
|
|
|
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
|
2015-12-16 23:49:22 -08:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
# For tmux <2.2
|
|
|
|
|
# UTF-8
|
|
|
|
|
#set -q -g status-utf8 on
|
|
|
|
|
#setw -q -g utf8 on
|
|
|
|
|
# Enable mouse
|
|
|
|
|
#setw -g mode-mouse on
|
|
|
|
|
#set -g mouse-resize-pane on
|
|
|
|
|
#set -g mouse-select-pane on
|
|
|
|
|
#set -g mouse-select-window on
|
2015-12-16 23:49:22 -08:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
# -- DISPLAY -----------------------------
|
|
|
|
|
|
|
|
|
|
set -g set-titles on
|
|
|
|
|
set -g set-titles-string "tmux [#H] #S:#W:#T"
|
2015-12-16 23:49:22 -08:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
# Zero-based indexing is fine in programming languages, but not so much in a multiplexer
|
|
|
|
|
# when zero is on the other side of the keyboard.
|
|
|
|
|
set -g base-index 1
|
|
|
|
|
setw -g pane-base-index 1
|
|
|
|
|
|
|
|
|
|
setw -g automatic-rename on # rename window to reflect current program
|
|
|
|
|
set -g renumber-windows on # renumber windows when a window is closed
|
|
|
|
|
# display tmux messages longer
|
|
|
|
|
set -g display-time 1500
|
|
|
|
|
set -g display-panes-time 800
|
|
|
|
|
# redraw status line less frequently
|
|
|
|
|
set -g status-interval 15
|
|
|
|
|
# activity
|
|
|
|
|
set -g monitor-activity on
|
|
|
|
|
set -g visual-activity off
|
2015-12-16 23:49:22 -08:00
|
|
|
|
|
|
|
|
|
# focus events enabled for terminals that support them
|
|
|
|
|
set -g focus-events on
|
|
|
|
|
|
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
# -- KEYBINDS ----------------------------
|
|
|
|
|
|
2013-03-20 17:56:10 -07:00
|
|
|
|
# set vi keys
|
|
|
|
|
setw -g mode-keys vi
|
2013-11-22 20:24:16 -08:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
setw -g xterm-keys on
|
|
|
|
|
# address vim mode switching delay (http://superuser.com/a/252717/65504)
|
|
|
|
|
set -s escape-time 0
|
|
|
|
|
set -sg repeat-time 600
|
|
|
|
|
|
|
|
|
|
# Custom prefix
|
|
|
|
|
set -g prefix C-c
|
|
|
|
|
bind C-c send-prefix
|
|
|
|
|
# GNU-Screen compatible prefix
|
|
|
|
|
# set -g prefix2 C-a
|
|
|
|
|
# bind C-a send-prefix -2
|
|
|
|
|
|
|
|
|
|
unbind C-b
|
|
|
|
|
|
|
|
|
|
## Pane management
|
2015-12-22 00:49:27 -08:00
|
|
|
|
# Saner splitting commands
|
2014-08-12 22:19:03 -07:00
|
|
|
|
unbind %
|
|
|
|
|
unbind '"'
|
2015-12-22 00:49:27 -08:00
|
|
|
|
bind s split-window -c "#{pane_current_path}" -v
|
|
|
|
|
bind v split-window -c "#{pane_current_path}" -h
|
|
|
|
|
bind c new-window -c "#{pane_current_path}"
|
2014-08-12 22:19:03 -07:00
|
|
|
|
|
2015-12-09 02:14:07 -08:00
|
|
|
|
# break pane into a window
|
2016-05-22 20:08:42 -07:00
|
|
|
|
bind = select-layout even-vertical
|
|
|
|
|
bind + select-layout even-horizontal
|
|
|
|
|
bind - break-pane
|
|
|
|
|
bind _ join-pane
|
2015-12-16 23:49:22 -08:00
|
|
|
|
|
|
|
|
|
# reload config without killing server
|
|
|
|
|
bind r source-file ~/.tmux.conf \; display-message " Config reloaded..".
|
2015-12-22 23:20:12 -08:00
|
|
|
|
bind ^r refresh-client
|
2015-12-09 02:14:07 -08:00
|
|
|
|
|
2015-11-17 21:58:42 -08:00
|
|
|
|
# Smart pane switching with awareness of vim splits
|
|
|
|
|
# See: https://github.com/christoomey/vim-tmux-navigator
|
|
|
|
|
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"
|
|
|
|
|
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
|
2015-12-16 23:49:22 -08:00
|
|
|
|
bind C-w last-pane
|
|
|
|
|
bind C-n next-window
|
|
|
|
|
bind C-p previous-window
|
|
|
|
|
|
|
|
|
|
# Pane resizing
|
|
|
|
|
bind C-h resize-pane -L 6
|
|
|
|
|
bind C-j resize-pane -D 6
|
|
|
|
|
bind C-k resize-pane -U 6
|
|
|
|
|
bind C-l resize-pane -R 6
|
|
|
|
|
bind -n M-h resize-pane -L 6
|
|
|
|
|
bind -n M-j resize-pane -D 6
|
|
|
|
|
bind -n M-k resize-pane -U 6
|
|
|
|
|
bind -n M-l resize-pane -R 6
|
2014-08-12 22:19:03 -07:00
|
|
|
|
|
2015-12-16 23:49:22 -08:00
|
|
|
|
# Swap panes directionally
|
2015-12-22 01:34:08 -08:00
|
|
|
|
bind h select-pane -L
|
|
|
|
|
bind j select-pane -D
|
|
|
|
|
bind k select-pane -U
|
|
|
|
|
bind l select-pane -R
|
2015-12-22 23:39:04 -08:00
|
|
|
|
bind H run '~/.dotfiles/tmux/swap-pane.sh left'
|
|
|
|
|
bind J run '~/.dotfiles/tmux/swap-pane.sh down'
|
|
|
|
|
bind K run '~/.dotfiles/tmux/swap-pane.sh up'
|
|
|
|
|
bind L run '~/.dotfiles/tmux/swap-pane.sh right'
|
|
|
|
|
bind M run '~/.dotfiles/tmux/swap-pane.sh master'
|
2014-12-13 16:35:07 -08:00
|
|
|
|
|
2015-12-16 23:49:22 -08:00
|
|
|
|
bind o resize-pane -Z
|
2015-12-20 21:39:11 -08:00
|
|
|
|
bind S choose-session
|
|
|
|
|
bind W choose-window
|
2015-12-16 23:49:22 -08:00
|
|
|
|
bind / choose-session
|
|
|
|
|
bind . choose-window
|
|
|
|
|
|
|
|
|
|
bind n run-shell 'TMUX= tmux new-session -t "$(basename \"$PWD\")" -d \; switch-client -t "$(basename \"$PWD\")"'
|
|
|
|
|
bind N run-shell 'TMUX= tmux new-session -t "$(tmux display-message -p #S)" -s "$(tmux display-message -p #S-clone)" -d \; switch-client -n \; display-message "session #S cloned"'
|
|
|
|
|
|
2015-12-22 00:49:27 -08:00
|
|
|
|
# bind = select-layout tiled
|
2015-12-16 23:49:22 -08:00
|
|
|
|
bind | select-layout even-horizontal
|
|
|
|
|
bind _ select-layout even-vertical
|
|
|
|
|
|
|
|
|
|
# switch between sessions
|
|
|
|
|
bind -r [ switch-client -p
|
|
|
|
|
bind -r ] switch-client -n
|
2014-09-21 07:10:23 -07:00
|
|
|
|
|
|
|
|
|
# Disable confirmation
|
|
|
|
|
bind x kill-pane
|
2015-12-16 23:49:22 -08:00
|
|
|
|
bind X kill-window
|
|
|
|
|
bind q kill-session
|
|
|
|
|
bind Q kill-server
|
2014-09-21 07:10:23 -07:00
|
|
|
|
|
2013-03-20 17:56:10 -07:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
# -- LIST CHOICE -------------------------
|
|
|
|
|
|
|
|
|
|
bind -t vi-choice h tree-collapse
|
|
|
|
|
bind -t vi-choice l tree-expand
|
|
|
|
|
run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null'
|
|
|
|
|
run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null'
|
|
|
|
|
bind -t vi-choice H tree-collapse-all
|
|
|
|
|
bind -t vi-choice L tree-expand-all
|
|
|
|
|
bind -t vi-choice Escape cancel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -- EDIT MODE ---------------------------
|
|
|
|
|
|
|
|
|
|
bind -ct vi-edit H start-of-line
|
|
|
|
|
bind -ct vi-edit L end-of-line
|
|
|
|
|
bind -ct vi-edit q cancel
|
|
|
|
|
bind -ct vi-edit Escape cancel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -- COPY MODE ---------------------------
|
|
|
|
|
|
|
|
|
|
bind Enter copy-mode # enter copy mode
|
|
|
|
|
bind b list-buffers # list paster buffers
|
|
|
|
|
bind p paste-buffer # paste from the top pate buffer
|
|
|
|
|
bind P choose-buffer # choose which buffer to paste from
|
|
|
|
|
|
|
|
|
|
bind -t vi-copy v begin-selection
|
|
|
|
|
bind -t vi-copy C-v rectangle-toggle
|
|
|
|
|
bind -t vi-copy y copy-selection
|
|
|
|
|
bind -t vi-copy Escape cancel
|
|
|
|
|
bind -t vi-copy H start-of-line
|
|
|
|
|
bind -t vi-copy L end-of-line
|
|
|
|
|
|
|
|
|
|
# copy to Mac OSX pasteboard
|
|
|
|
|
if -b 'type -p reattach-to-user-namespace > /dev/null 2>&1' 'bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -- THEME -------------------------------
|
|
|
|
|
|
|
|
|
|
# set -g status-justify left
|
|
|
|
|
# set -g status-right-length 100
|
|
|
|
|
# set -g status-left-length 80
|
|
|
|
|
# set -g status-left "#(~/.dotfiles/tmux/conf-status.sh left) "
|
|
|
|
|
# set -g status-right "#(~/.dotfiles/tmux/conf-status.sh right) "
|
|
|
|
|
#
|
|
|
|
|
# set -g window-status-format " #I #W:#T "
|
|
|
|
|
# set -g window-status-current-format " › #W:#T "
|
|
|
|
|
|
|
|
|
|
## Status bar design
|
|
|
|
|
# status line
|
|
|
|
|
set -g status-bg colour4
|
|
|
|
|
set -g status-fg colour12
|
|
|
|
|
set -g status-interval 10
|
|
|
|
|
|
|
|
|
|
# messaging
|
|
|
|
|
set -g message-fg black
|
|
|
|
|
set -g message-bg yellow
|
|
|
|
|
set -g message-command-fg blue
|
|
|
|
|
set -g message-command-bg black
|
|
|
|
|
|
|
|
|
|
# window mode
|
|
|
|
|
setw -g mode-bg colour6
|
|
|
|
|
setw -g mode-fg colour0
|
|
|
|
|
|
|
|
|
|
# window status
|
|
|
|
|
setw -g window-status-current-bg colour0
|
|
|
|
|
setw -g window-status-current-fg colour11
|
|
|
|
|
setw -g window-status-current-attr dim
|
|
|
|
|
setw -g window-status-bg green
|
|
|
|
|
setw -g window-status-fg black
|
|
|
|
|
setw -g window-status-attr reverse
|
|
|
|
|
|
|
|
|
|
# Info on left (I don't have a session display for now)
|
|
|
|
|
set -g status-left ''
|
|
|
|
|
|
|
|
|
|
# loud or quiet?
|
|
|
|
|
set-option -g visual-activity off
|
|
|
|
|
set-option -g visual-bell off
|
|
|
|
|
set-option -g visual-silence off
|
|
|
|
|
set-window-option -g monitor-activity off
|
|
|
|
|
set-option -g bell-action none
|
|
|
|
|
|
|
|
|
|
# The modes
|
|
|
|
|
setw -g clock-mode-colour colour135
|
|
|
|
|
setw -g mode-attr bold
|
|
|
|
|
setw -g mode-fg colour196
|
|
|
|
|
setw -g mode-bg colour238
|
|
|
|
|
|
|
|
|
|
# The panes
|
|
|
|
|
set -g pane-border-bg colour235
|
|
|
|
|
set -g pane-border-fg colour238
|
|
|
|
|
set -g pane-active-border-fg colour4
|
|
|
|
|
set -g pane-active-border-bg colour235
|
|
|
|
|
|
|
|
|
|
# The statusbar
|
|
|
|
|
set -g status-position bottom
|
|
|
|
|
set -g status-fg colour137
|
|
|
|
|
set -g status-bg colour8
|
|
|
|
|
# set -g status-bg colour236
|
|
|
|
|
set -g status-attr dim
|
|
|
|
|
set -g status-left ''
|
|
|
|
|
set -g status-right "#[fg=colour4]#(echo ${USER})#[fg=colour241]@#[fg=colour12]#(hostname) "
|
|
|
|
|
set -g status-right-length 40
|
|
|
|
|
set -g status-left-length 30
|
|
|
|
|
|
|
|
|
|
# setw -g window-status-current-fg colour9
|
|
|
|
|
setw -g window-status-current-fg colour81
|
|
|
|
|
setw -g window-status-current-bg colour0
|
|
|
|
|
setw -g window-status-current-attr bold
|
|
|
|
|
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
|
|
|
|
|
|
|
|
|
|
setw -g window-status-fg colour242
|
|
|
|
|
setw -g window-status-bg colour8
|
|
|
|
|
setw -g window-status-attr none
|
|
|
|
|
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour240]#W#[fg=colour240]#F '
|
2015-10-25 21:41:47 -07:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
setw -g window-status-bell-attr bold
|
|
|
|
|
setw -g window-status-bell-fg colour255
|
|
|
|
|
setw -g window-status-bell-bg colour1
|
2015-10-25 21:41:47 -07:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
# The messages
|
|
|
|
|
set -g message-attr bold
|
|
|
|
|
set -g message-fg colour232
|
|
|
|
|
set -g message-bg colour5
|
2015-10-25 21:41:47 -07:00
|
|
|
|
|
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
##
|
|
|
|
|
run-shell "~/.dotfiles-new/shell/tmux/scripts/prefix-highlight.tmux"
|
2015-12-22 00:49:27 -08:00
|
|
|
|
|
2016-10-30 06:28:05 -07:00
|
|
|
|
## User defined overrides
|
|
|
|
|
if '[ -f ~/.tmux.local.conf ]' 'source ~/.tmux.local.conf'
|