-
Notifications
You must be signed in to change notification settings - Fork 1
/
.tmux.conf
181 lines (142 loc) · 6.08 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Author : Enan Ajmain
# Email : [email protected]
# Github : https://github.com/3N4N
# -- General -------------------------------------------------------------------
set -g escape-time 10 # wait 10ms after Esc key
set -g repeat-time 500 # wait 100ms for repeating command
set -g focus-events on
set -g set-clipboard on
set -g history-limit 5000
set -g default-command "${SHELL}"
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ',xterm-256color*:Tc'
set -as terminal-overrides ',st-256color:Ms=\E]52;%p1%s;%p2%s\007'
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
set -g set-titles on
set -g set-titles-string "#T"
# -- Display -------------------------------------------------------------------
set -g base-index 1 # start windows numbering at 1
set -g pane-base-index 0
set -g allow-rename off
set -g renumber-windows on # re-number windows when a window is closed
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 500 # slightly longer status messages display time
set -g status-interval 10 # redraw status line every 10 seconds
# Loud or quiet?
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
set -g monitor-activity off
set -g bell-action none
# -- Key Bindings --------------------------------------------------------------
# Set prefix
unbind C-b
set -g prefix C-Space
# Easy config reloads
unbind r
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# Get into command mode easily
bind \; command-prompt
# Toggle mouse
set -g mouse on
bind m set -g mouse \; display 'Mouse #{?mouse,enabled,disabled}'
# Vim style mode
set -g mode-keys vi
set -g status-keys emacs
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -selection clipboard'
# Create session and window
bind c new-window -ac "#{pane_current_path}"
bind C-c new-window
# Synchronize panes i.e. send same keycords to every panes in this window
bind S set synchronize-panes \; display 'Synchronization#{?pane_synchronized,on,off}'
# Don't display previous window/session name when renaming
bind , command-prompt -p "rename-window from '#W' to" "rename-window '%%'"
bind '$' command-prompt -p "rename-session from '#S' to" "rename-session '%%'"
# Session switcher
bind s choose-tree -s -Z -F '#{?pane_format,#{pane_current_command},\
#{?window_format,#{window_name},#{?session_grouped,\
(group #{session_group}: #{session_group_list}),}#{?session_attached,(attached),}}}'
# Window switcher
bind w choose-tree -w -Z -f '#{session_attached}' \
-F '#{?pane_format,#{pane_current_command},\
#{?window_format,#{window_name},#{?session_grouped,\
(group #{session_group}: #{session_group_list}),}}}'
# Window and Session switching
unbind p
unbind n
bind -n M-h previous-window
bind -n M-l next-window
bind -n M-j switch-client -n
bind -n M-k switch-client -p
bind -n M-p last-window
# Pane resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Pane splitting
bind v split-window -h -c "#{pane_current_path}"
bind b split-window -v -c "#{pane_current_path}"
# Movement of windows with prefix+</>
bind -r < swap-window -t -1 \; previous-window
bind -r > swap-window -t +1 \; next-window
# -- Vim Tmux Navigator --------------------------------------------------------
if-shell -b 'grep -qEi "(MINGW64_NT|MSYS_NT)" /proc/version' {
bind -n C-M-h select-pane -L
bind -n C-M-j select-pane -D
bind -n C-M-k select-pane -U
bind -n C-M-l select-pane -R
unbind -n C-h
unbind -n C-j
unbind -n C-k
unbind -n C-l
} {
bind -n C-h run \
"((tmux list-panes -F '#F' | grep -q Z && tmux send-keys C-h) || \
((tmux display-message -p '#{pane_current_command}' | grep -iq vim \
&& tmux send-keys C-h) || tmux select-pane -L ))"
bind -n C-j run \
"((tmux list-panes -F '#F' | grep -q Z && tmux send-keys C-j) || \
((tmux display-message -p '#{pane_current_command}' | grep -iq vim \
&& tmux send-keys C-j) || tmux select-pane -D ))"
bind -n C-k run \
"((tmux list-panes -F '#F' | grep -q Z && tmux send-keys C-k) || \
((tmux display-message -p '#{pane_current_command}' | grep -iq vim \
&& tmux send-keys C-k) || tmux select-pane -U ))"
bind -n C-l run \
"((tmux list-panes -F '#F' | grep -q Z && tmux send-keys C-l) || \
((tmux display-message -p '#{pane_current_command}' | grep -iq vim \
&& tmux send-keys C-l) || tmux select-pane -R ))"
# bind -n C-\ select-pane -l
}
bind -T copy-mode-vi C-h run "(tmux list-panes -F '#F' | grep -q Z || tmux select-pane -L)"
bind -T copy-mode-vi C-j run "(tmux list-panes -F '#F' | grep -q Z || tmux select-pane -D)"
bind -T copy-mode-vi C-k run "(tmux list-panes -F '#F' | grep -q Z || tmux select-pane -U)"
bind -T copy-mode-vi C-l run "(tmux list-panes -F '#F' | grep -q Z || tmux select-pane -R)"
# bind -T copy-mode-vi C-\ select-pane -l
# Rebind shadowed keys in Bash
bind C-h send-keys 'C-h'
bind C-j send-keys 'C-j'
bind C-k send-keys 'C-k'
bind C-l send-keys 'C-l'
# -- Statusbar -----------------------------------------------------------------
set -g mode-style bg=colour3,fg=colour7
set -g message-style bg=colour3,fg=colour7
set -g status-position top
set -g status-justify right
set -g status-bg colour7
set -g status-fg colour0
set -g status-left-length 50
set -g status-right-length 50
set -g window-status-current-format "#[fg=colour7]\
#{?window_zoomed_flag,#[bg=colour3],#[bg=colour4]} #I:#{s/.*\\\\|\.exe//:window_name} "
set -g window-status-format "#{?window_last_flag,#[bg=default]#[fg=default],\
#[bg=default]#[fg=default]}#I:#{s/.*\\\\|\.exe//:window_name}"
set -g status-left "#[bg=colour5]#[fg=colour7] #S #[bg=default] \
#[bg=colour2]#[fg=colour7] %b %d %H:%M #[bg=default] \
#{?client_prefix,#[bg=colour1]#[fg=colour7],#[bg=default]#[fg=colour7]} \
PREFIX #{?client_prefix,#[bg=default],} "
set -g status-right "#[bg=colour7] #[bg=colour2]#[fg=colour7] %b %d %a \
#[bg=default] #[bg=colour5]#[fg=colour7] %H:%M "
set -g status-right " "