/
tmux.conf
133 lines (99 loc) · 4.9 KB
/
tmux.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Reset tmux prefix command key to ctrl-a
set -g prefix C-a
unbind C-b
# Bind Ctrl-s globally to send out prefix to remote server
bind -n C-s send-prefix
# Set swap pane key
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Toggle the broadcast
bind a setw synchronize-panes
# helps in faster key repetition
set -sg escape-time 0
# source .tmux.conf file
bind r source-file ~/.tmux.conf \; display "Configuration Reloaded!"
# switch to last window
bind b previous-window
# switch to last session
bind Enter switch-client -l
# don't rename windows automatically
setw -g allow-rename off
# increase history size
set -g history-limit 20000
# 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 on
# enable mouse
setw -g mouse on
# set 256 color
set -g default-terminal "tmux-256color"
# focus event
set-option -g focus-events on
# Tc enables true color
set -ag terminal-overrides ",*256col*:colors=256:Tc"
# Ms modifies OSC 52 clipboard handling to work with mosh, see
# https://gist.github.com/yudai/95b20e3da66df1b066531997f982b57b
## For Tmux <= 3.2
# set -ag terminal-overrides "vte*:XT:Ms=\\E]52;c;%p2%s\\7,xterm*:XT:Ms=\\E]52;c;%p2%s\\7"
## Tmux 3.3+
set -as terminal-overrides ',xterm-256color:Ms=\E]52;%p1%s;%p2%s\007'
set -as terminal-features ',xterm-256color:clipboard'
# enable OSC 52 clipboard
# https://medium.freecodecamp.org/tmux-in-practice-integration-with-system-clipboard-bcd72c62ff7b
set -g set-clipboard on
# monitor activities in other windows
setw -g monitor-activity on
set -g visual-activity off
# monitor bell
set -g monitor-bell on
set -g visual-bell off
set -g bell-action any
set -g window-status-bell-style bg=yellow,noreverse,blink
# Vi copypaste mode
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi 'r' send-keys -X rectangle-toggle
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection
# set window/pane index start from 1
set -g base-index 1
setw -g pane-base-index 1
# Window index get reordered on delete
set-option -g renumber-windows on
# Update tmux environment from shell
# - notes: It won't update current shell environment inside tmux sessions
# - notes: Don't include SSH_AUTH_SOCK here, otherwise 'setenv -g SSH_AUTH_SOCK' has no effect
set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION SSH_CLIENT SSH_TTY WINDOWID XAUTHORITY KRB5CCNAME TERM'
# Set shell environment SSH_AUTH_SOCK to a fixed path for fixing the broken ssh agent
setenv -g SSH_AUTH_SOCK ${HOME}/.ssh/auth-sock
# Default shell zsh > bash
#set-option -g default-shell /usr/bin/zsh
# status bar theme
set -g status-bg 'colour235'
#set -g status-justify 'centre'
#set -g status-right-attr 'none'
#set -g status-attr 'none'
#set -g status-left-attr 'none'
set -g status 'on'
# default is 15s
set -g status-interval 15
set -g pane-border-style fg='colour238'
set -g pane-active-border-style fg='colour154'
set -g message-style fg='colour222',bg='colour238'
set -g message-command-style fg='colour222',bg='colour238'
setw -g window-status-activity-style fg='colour154',bg='colour235',none
setw -g window-status-style fg='colour121',bg='colour235',none
setw -g window-status-separator ''
# TODO: set per pane title, but seems not that useful, need more research
set -g pane-border-status off # top | bottom | off
set -g pane-border-format '#{pane_index} #(hostname | cut -d "." -f1): #{pane_current_command}'
set -g status-left-length '25'
set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #(whoami) #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] #(ping www.google.com -c 1 | tail -1 | cut -d "/" -f5)ms #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
set -g status-right-length '140'
set -g status-right '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] #(tmux ls | wc -l | sed "s/ //g") #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #(hostname | cut -d "." -f1) #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour232,bg=colour154] #(bash ~/.tmux/remote_hostname.sh | cut -d "." -f1) #[fg=colour232,bg=colour150] #(bash ~/.tmux/nw_ttl.sh)'
setw -g window-status-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[default] #I #W #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
setw -g window-status-current-format '#[fg=colour235,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #I #W #F #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]'
# Load user local tmux.conf
source-file -q ~/.tmux/user.conf