-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
108 lines (91 loc) · 3.77 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
# ~/.tmux.conf
# version >= 2.8
# easy reload config
bind r source-file $HOME/.tmux.conf \; display-message "$HOME/.tmux.conf reloaded."
# C-a as prefix key similar screen
set -g prefix C-a
# C-a a, send commands to embedded tmux session
bind a send-prefix
# switch to last window
bind C-a last-window
# window split
unbind '"'
unbind '%'
bind - split-window -v
bind = split-window -h
# switch panes
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# resize panes
bind -r C-k resize-pane -U 2
bind -r C-j resize-pane -D 2
bind -r C-h resize-pane -L 4
bind -r C-l resize-pane -R 4
# popup pane
if-shell -b '[ $(echo "$(tmux -V | cut -d" " -f2 | tr -d " [:alpha:]") > 3.1" | bc) -eq 1 ]' '\
bind C-p display-popup -E -w 75% -h 75%'
# default statusbar and fg,bg colors
set -g status-style fg=colour6
# window color
if-shell -b '[ $(echo "$(tmux -V | cut -d" " -f2 | tr -d " [:alpha:]") > 2.9" | bc) -eq 1 ]' '\
set -gw window-style bg=black; \
set -gw window-active-style bg=terminal'
# window title colors
set -gw window-status-style fg=colour6
set -gw window-status-current-style fg=colour3,bright
# separator between windows numbers
#set -gw window-status-separator ' | '
# message text color
set -g message-style fg=colour1
# pane number display fg color
set -g display-panes-colour colour7
set -g display-panes-active-colour colour3
# pane border display color
set -g pane-border-style fg=colour7
set -g pane-active-border-style fg=colour3
#set -g pane-border-status bottom
# status style
set -g status-interval 1
set -g status-justify left # left | centre | right | absolute-centre
set -g status-left-length 80
set -g status-right-length 50
set -g status-left ' #[fg=colour7]#{?client_prefix,#[fg=colour1],}[#{?SSH_CONNECTION,SSH:,}#S] #[default]'
set -g status-right '#[fg=colour7][#h] #[fg=colour6][%a %h %d %T %Y] '
#set -g base-index 1 # start window index from 1
#set -g pane-base-index 1 # start pane index from 1
set -g renumber-windows on # reorder window num
# allow mouse
set -g mouse on
# history
set -g history-limit 30000
# window notifications
set -gw monitor-activity off
set -g visual-activity on
# update the TERM variable of terminal emulator
set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY XDG_SESSION_TYPE TERM'
# vi-mode copy to system clipboard
setw -g mode-keys vi
if-shell -b 'hash xclip 2>/dev/null' '\
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"; \
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"'
if-shell -b 'hash xsel 2>/dev/null' '\
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -b"; \
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel -i -b"'
if-shell -b 'hash wl-copy 2>/dev/null' '\
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"; \
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "wl-copy"'
if-shell -b 'hash pbcopy 2>/dev/null' '\
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"; \
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"'
# scroll one line a time
if-shell -b '[ $(echo "$(tmux -V | cut -d" " -f2 | tr -d " [:alpha:]") > 2.4" | bc) -eq 1 ]' '\
bind -T copy-mode-vi WheelUpPane send -N1 -X scroll-up; \
bind -T copy-mode-vi WheelDownPane send -N1 -X scroll-down'
# 256 colors
# curl -LO https://invisible-island.net/datafiles/current/terminfo.src.gz && gunzip terminfo.src.gz
# /usr/bin/tic -xe tmux-256color terminfo.src
if-shell '[ "$(tput colors)" = "256" ]' '\
set -g default-terminal tmux-256color; set -ga terminal-overrides ",*256col*:Tc"' '\
set -g default-terminal xterm'