/
tmux-2.8.conf
182 lines (139 loc) · 5.81 KB
/
tmux-2.8.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
# Tmux 2.8 and below
# Truecolor support
set -ga terminal-overrides ",xterm-256color:Tc"
set -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Default 2000
set -g history-limit 100000
# Easy config reload
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
# vi is good
setw -g mode-keys vi
# enable mouse
# doesn't work on tmux 2.2
# set -g mouse-utf8 on
set -g mouse on
# Fix for copy and paste issue on MacOS Sierra
set -g default-shell $SHELL
set -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"
# Copy/paste for tmux 2.3 and below
# Setup 'v' to begin selection as in Vim
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
# unbind -t vi-copy Enter
# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# Copy/paste support for tmux 2.4, to enable pressing y/Enter to copy and paste in vim,
# Probably not needed on newer version of tmux
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection
bind-key -T copy-mode-vi Enter send -X copy-pipe "reattach-to-user-namespace pbcopy"
# Copy and paste support in vim for For tmux > 2.4
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
# To support itatlic for tmux, by default screen & screen-256color do not support italic
# Need to install the term info tic -x tmux.terminfo
set -g default-terminal "tmux-256color"
set -as terminal-overrides ',xterm*:sitm=\E[3m' # this probably only needs to happen in OS X'
bind-key : command-prompt
bind-key r refresh-client
bind-key L clear-history
bind-key C clear
# bind-key space next-window
bind-key space last-window
bind-key bspace previous-window
bind-key enter next-layout
# use vim-like keys for splits and windows
bind-key v split-window -h -c "#{pane_current_path}"
bind-key C-V split-window -h -c "#{pane_current_path}" -p 50 -b
bind-key t split-window -h -c "#{pane_current_path}" -p 40
bind-key C-t split-window -h -c "#{pane_current_path}" -p 60 -b
bind-key s split-window -v -c "#{pane_current_path}"
bind-key C-S split-window -v -c "#{pane_current_path}" -p 50 -b
bind-key g split-window -v -c "#{pane_current_path}" -p 30
bind-key C-g split-window -v -c "#{pane_current_path}" -p 70 -b
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# uncomment below stanza to enable smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# move window
bind -n M-{ swap-window -t -1
bind -n M-} swap-window -t +1
# Unbind suspend key
unbind-key C-z
# Zoom pane
bind -n C-z run "tmux resize-pane -Z"
# Bring back clear screen under tmux prefix
bind C-l send-keys 'C-l'
bind-key C-o rotate-window
set-window-option -g other-pane-height 25
set-window-option -g other-pane-width 80
# bind-key o last-window
bind-key q display-panes
bind-key c new-window
# bind-key t next-window
# bind-key T previous-window
bind-key [ copy-mode
bind-key ] paste-buffer
set-window-option -g display-panes-time 1500
# Status Bar
set -g status-interval 1
set -g status-left ''
set -g status-right '%l:%M%p'
set-window-option -g window-status-current-fg magenta
set -g status-fg default
# Theme: solarized-dark
set -g status-bg black
set -g pane-active-border-fg black
set -g pane-border-fg black
# Status Bar solarized-light
# if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set -g status-bg white"
# if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set -g pane-active-border-fg white"
# if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set -g pane-border-fg white"
# Theme: onedark
set -g pane-active-border-fg colour8
set -g pane-border-fg colour8
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
# Allow the arrow key to be used immediately after changing windows
set -g repeat-time 0
# set -g terminal-overrides 'xterm*:smcup@:rmcup@'
bind-key | select-layout main-vertical
bind-key \ select-layout main-horizontal
bind-key = resize-pane -R 10
bind-key - resize-pane -L 10
bind-key + resize-pane -D 10
bind-key _ resize-pane -U 10
# Renumber windows sequentially after closing any of them.
# Otherwise if you close the second tab of three, you end
# up with tabs numbered 1 and 3.
# set -g renumber-windows on
# set window and pane index to 1 (0 by default)
# set -g base-index 1
# setw -g pane-base-index 1
set -g pane-base-index 1
# Allows for faster key repetition
set -s escape-time 0
# Clear screen
bind-key k send-keys -R \; send-keys C-l \; clear-history
# Set dir name to current directory name
bind-key e send-keys "tmux rename-window $(basename \$PWD)\n"
bind-key E send-keys "tmux rename-session $(basename \$PWD)\n"
# Set tab title
set -g set-titles on
# #H:#S.#I.#P #W #T - window number,program name, active(or not)
set -g set-titles-string '#I.#P #W'
# break pane
bind-key b break-pane
source-file ~/.tmux.conf.local