5 bind r source-file $HOME/.tmux.conf \; display-message "$HOME/.tmux.conf reloaded."
7 # C-a as prefix key similar screen
10 # C-a a, send commands to embedded tmux session
13 # switch to last window
19 bind - split-window -v
20 bind = split-window -h
23 bind -r k select-pane -U
24 bind -r j select-pane -D
25 bind -r h select-pane -L
26 bind -r l select-pane -R
29 bind -r C-k resize-pane -U 2
30 bind -r C-j resize-pane -D 2
31 bind -r C-h resize-pane -L 4
32 bind -r C-l resize-pane -R 4
35 if-shell -b '[ $(echo "$(tmux -V | cut -d" " -f2 | tr -d " [:alpha:]") > 3.1" | bc) -eq 1 ]' '\
36 bind C-p display-popup -E -w 75% -h 75%'
38 # default statusbar and fg,bg colors
39 set -g status-style fg=colour6
41 if-shell -b '[ $(echo "$(tmux -V | cut -d" " -f2 | tr -d " [:alpha:]") > 2.9" | bc) -eq 1 ]' '\
42 set -gw window-style bg=black; \
43 set -gw window-active-style bg=terminal'
45 set -gw window-status-style fg=colour6
46 set -gw window-status-current-style fg=colour3,bright
47 # separator between windows numbers
48 #set -gw window-status-separator ' | '
50 set -g message-style fg=colour1
51 # pane number display fg color
52 set -g display-panes-colour colour7
53 set -g display-panes-active-colour colour3
54 # pane border display color
55 set -g pane-border-style fg=colour7
56 set -g pane-active-border-style fg=colour3
57 #set -g pane-border-status bottom
60 set -g status-interval 1
61 set -g status-justify left # left | centre | right | absolute-centre
62 set -g status-left-length 80
63 set -g status-right-length 50
64 set -g status-left ' #[fg=colour7]#{?client_prefix,#[fg=colour1],}[#{?SSH_CONNECTION,SSH:,}#S] #[default]'
65 set -g status-right '#[fg=colour7][#h] #[fg=colour6][%a %h %d %T %Y] '
66 #set -g base-index 1 # start window index from 1
67 #set -g pane-base-index 1 # start pane index from 1
68 set -g renumber-windows on # reorder window num
74 set -g history-limit 30000
76 # window notifications
77 set -gw monitor-activity off
78 set -g visual-activity on
80 # update the TERM variable of terminal emulator
81 set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY XDG_SESSION_TYPE TERM'
83 # vi-mode copy to system clipboard
85 if-shell -b 'hash xclip 2>/dev/null' '\
86 bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"; \
87 bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"'
88 if-shell -b 'hash xsel 2>/dev/null' '\
89 bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -b"; \
90 bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel -i -b"'
91 if-shell -b 'hash wl-copy 2>/dev/null' '\
92 bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"; \
93 bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "wl-copy"'
94 if-shell -b 'hash pbcopy 2>/dev/null' '\
95 bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"; \
96 bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"'
98 # scroll one line a time
99 if-shell -b '[ $(echo "$(tmux -V | cut -d" " -f2 | tr -d " [:alpha:]") > 2.4" | bc) -eq 1 ]' '\
100 bind -T copy-mode-vi WheelUpPane send -N1 -X scroll-up; \
101 bind -T copy-mode-vi WheelDownPane send -N1 -X scroll-down'
104 if-shell '[ "$(tput colors)" = "256" ]' '\
105 set -g default-terminal xterm-256color; set -ga terminal-overrides ",*256col*:Tc"' '\
106 set -g default-terminal xterm'