2013-03-20 17:56:10 -07:00
|
|
|
## Behavior ###############
|
2015-12-16 23:49:22 -08:00
|
|
|
# utf-8
|
|
|
|
set -g utf8 on
|
|
|
|
set -g status-utf8 on
|
|
|
|
|
2013-03-17 19:23:39 -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
|
2013-03-20 17:56:10 -07:00
|
|
|
set -g renumber-windows on
|
|
|
|
setw -g automatic-rename on
|
2015-12-16 23:49:22 -08:00
|
|
|
|
|
|
|
# address vim mode switching delay (http://superuser.com/a/252717/65504)
|
|
|
|
set -g escape-time 0
|
|
|
|
|
|
|
|
# tmux messages are displayed for 4 seconds
|
|
|
|
set -g display-time 2000
|
|
|
|
|
2014-08-12 22:19:03 -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
|
2013-03-20 17:56:10 -07:00
|
|
|
# client connected to *that window*. Much more reasonable.
|
2014-04-11 02:54:46 -07:00
|
|
|
setw -g aggressive-resize off
|
2015-12-16 23:49:22 -08:00
|
|
|
|
2013-03-20 17:56:10 -07:00
|
|
|
# go zsh, go
|
2015-12-16 23:49:22 -08:00
|
|
|
set -g default-shell $SHELL
|
|
|
|
|
2013-03-21 07:52:15 -07:00
|
|
|
# a mouse
|
2015-12-16 23:49:22 -08:00
|
|
|
# setw -g mouse-utf8 on
|
2015-10-28 14:22:28 -07:00
|
|
|
setw -g mouse on
|
2015-12-16 23:49:22 -08:00
|
|
|
|
2015-11-23 18:51:38 -08:00
|
|
|
# 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'"
|
2013-03-20 17:56:10 -07:00
|
|
|
|
2015-12-16 23:49:22 -08:00
|
|
|
# set -g visual-activity off
|
|
|
|
setw -g monitor-activity on
|
|
|
|
|
|
|
|
# focus events enabled for terminals that support them
|
|
|
|
set -g focus-events on
|
|
|
|
|
|
|
|
# increase scrollback buffer size
|
|
|
|
set -g history-limit 10000
|
|
|
|
|
2013-03-20 17:56:10 -07:00
|
|
|
## Key bindings ###########
|
|
|
|
# Remap the key prefix
|
2015-12-16 23:49:22 -08:00
|
|
|
set -g prefix ^c
|
|
|
|
set -g prefix2 ^f
|
2013-11-22 20:24:16 -08:00
|
|
|
unbind C-b
|
2014-10-09 15:31:22 -07:00
|
|
|
# Restore sigterm C-c
|
|
|
|
bind C-c send-prefix
|
2013-03-20 17:56:10 -07:00
|
|
|
# set vi keys
|
|
|
|
setw -g mode-keys vi
|
|
|
|
unbind [
|
|
|
|
bind Escape copy-mode
|
|
|
|
unbind p
|
|
|
|
bind p paste-buffer
|
|
|
|
bind-key -t vi-copy 'v' begin-selection
|
2013-11-22 20:24:16 -08:00
|
|
|
bind-key -t vi-copy 'y' copy-pipe "reattach-to-user-namespace pbcopy"
|
|
|
|
|
|
|
|
unbind -t vi-copy Enter
|
|
|
|
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
|
|
|
|
|
2014-08-12 22:19:03 -07:00
|
|
|
## Pane management #####
|
|
|
|
# Better splitting keybinds
|
|
|
|
unbind %
|
|
|
|
unbind '"'
|
2014-08-12 23:46:29 -07:00
|
|
|
bind s split-window -v
|
|
|
|
bind v split-window -h
|
2014-08-12 22:19:03 -07:00
|
|
|
|
2015-12-09 02:14:07 -08:00
|
|
|
# break pane into a window
|
2015-12-16 23:49:22 -08:00
|
|
|
bind = break-pane
|
|
|
|
bind - join-pane
|
|
|
|
|
|
|
|
# reload config without killing server
|
|
|
|
bind r source-file ~/.tmux.conf \; display-message " Config reloaded..".
|
|
|
|
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
|
|
|
|
|
|
|
|
bind -n C-1 select-window -t :1
|
|
|
|
bind -n C-2 select-window -t :2
|
|
|
|
bind -n C-3 select-window -t :3
|
|
|
|
bind -n C-4 select-window -t :4
|
|
|
|
bind -n C-5 select-window -t :5
|
|
|
|
bind -n C-6 select-window -t :6
|
|
|
|
bind -n C-7 select-window -t :7
|
|
|
|
bind -n C-8 select-window -t :8
|
|
|
|
bind -n C-9 select-window -t :9
|
|
|
|
|
|
|
|
# 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
|
|
|
|
bind H run '~/.dotfiles/tmux/swap-pane.rb left'
|
|
|
|
bind J run '~/.dotfiles/tmux/swap-pane.rb down'
|
|
|
|
bind K run '~/.dotfiles/tmux/swap-pane.rb up'
|
|
|
|
bind L run '~/.dotfiles/tmux/swap-pane.rb right'
|
|
|
|
bind M run '~/.dotfiles/tmux/swap-pane.rb master'
|
2014-12-13 16:35:07 -08:00
|
|
|
|
2015-12-16 23:49:22 -08:00
|
|
|
bind o resize-pane -Z
|
|
|
|
bind P run-shell '~/.dotfiles/tmux/select-pane.sh'
|
|
|
|
bind S run-shell '~/.dotfiles/tmux/select-session.sh'
|
|
|
|
bind W run-shell '~/.dotfiles/tmux/select-window.sh'
|
|
|
|
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"'
|
|
|
|
|
|
|
|
bind = select-layout tiled
|
|
|
|
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
|
|
|
# quick view of processes
|
|
|
|
bind '~' split-window "exec top"
|
|
|
|
|
|
|
|
## Looks ########################
|
2015-12-16 23:49:22 -08:00
|
|
|
set -g set-titles on
|
|
|
|
set -g set-titles-string "tmux [#H] #S/#W/#T"
|
2015-10-25 21:41:47 -07:00
|
|
|
|
2015-12-16 23:49:22 -08:00
|
|
|
set -s default-terminal "xterm-256color"
|
2015-10-25 21:41:47 -07:00
|
|
|
|
2015-12-16 23:49:22 -08:00
|
|
|
setw -g window-status-fg colour245
|
|
|
|
setw -g window-status-bg colour237
|
|
|
|
setw -g window-status-current-fg yellow
|
|
|
|
setw -g window-status-current-bg black
|
|
|
|
setw -g window-status-activity-attr bold,blink
|
|
|
|
setw -g window-status-activity-bg colour236
|
|
|
|
setw -g window-status-activity-fg white
|
2015-10-25 21:41:47 -07:00
|
|
|
|
|
|
|
set -g pane-active-border-fg yellow
|
2015-12-16 23:49:22 -08:00
|
|
|
set -g pane-border-fg colour238
|
2013-03-17 19:23:39 -07:00
|
|
|
|
2015-12-16 23:49:22 -08:00
|
|
|
set -g status-bg colour237
|
|
|
|
set -g status-fg white
|
|
|
|
set -g status-interval 60
|
|
|
|
set -g status-justify left
|
|
|
|
set -g status-right-length 100
|
|
|
|
set -g status-left-length 80
|
|
|
|
set -g status-left '#[fg=white] #S #[fg=yellow]'
|
|
|
|
set -g status-right "#[fg=colour242]<#[fg=colour248]< #(sysctl -n vm.loadavg | awk '{ print $2,$3,$4 }') < #[fg=yellow]#(dig +short myip.opendns.com @208.67.222.222) #[bg=yellow]#[fg=black] #(hostname) "
|
2015-10-25 21:41:47 -07:00
|
|
|
|
2015-12-16 23:49:22 -08:00
|
|
|
set -g window-status-format " #I #W:#T "
|
|
|
|
set -g window-status-current-format " ⮀ #W:#T "
|