forked from yqrashawn/yqdotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.tmux.conf
200 lines (152 loc) · 7.09 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# use C-a, since it's on the home row and easier to hit than C-b
unbind-key C-b
set-option -g prefix C-q
bind-key C-q send-prefix
set -g base-index 1
# Easy config reload
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
# vi is good
setw -g mode-keys vi
# mouse behavior
set -g mouse on
# Emacs bindings in command line
set-window-option -g status-keys emacs
# set -g default-terminal "xterm-256color"
# set-option -g default-terminal screen-256color
set -g default-terminal "xterm-24bit"
set -g terminal-overrides ',xterm-24bit:Tc'
bind-key : command-prompt
bind-key r refresh-client
bind-key L clear-history
bind-key space next-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 s split-window -v -c "#{pane_current_path}"
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
bind-key C-h select-pane -L
bind-key C-j select-pane -D
bind-key C-k select-pane -U
bind-key C-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"
# bind C-l send-keys 'C-l'
bind-key C-o rotate-window
bind-key + select-layout main-horizontal
bind-key = select-layout main-vertical
set-window-option -g other-pane-height 25
set-window-option -g other-pane-width 80
bind-key a last-pane
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
# Renumber windows automatically
set-option -g renumber-windows on
# Allow faster key repetition
set-option -s escape-time 0
# Start panes at 1 instead of 0. Tmux 1.6+
set-window-option -g pane-base-index 1
# Automatically set content size to smallest connected terminal
set-window-option -g aggressive-resize on
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6-)"
# Setup 'v' to begin selection as in Vim
# Update default binding of `Enter` to also use copy-pipe
#
# New keybindings for vi-mode when version >= 2.4
# https://github.com/tmux/tmux/issues/754
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' \
'bind-key -T copy-mode-vi v send-keys -X begin-selection ; \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" ; \
unbind -T copy-mode-vi Enter ; \
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"; ' \
'bind-key -t vi-copy v begin-selection ; \
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" ; \
unbind -t vi-copy Enter ; \
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"; '
set-window-option -g display-panes-time 1500
# Status Bar
# set-option -g status-interval 1
# set-option -g status-left ''
# set-option -g status-right '%l:%M%p'
# set-window-option -g window-status-current-fg magenta
# set-option -g status-fg default
# Status Bar solarized-dark (default)
# set-option -g status-bg black
# set-option -g pane-active-border-fg black
# set-option -g pane-border-fg black
# Status Bar solarized-light
# if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g status-bg white"
# if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-active-border-fg white"
# if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-border-fg white"
# session management
bind e command-prompt -p find-session 'switch-client -t %%'
set-option -g status-justify left
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
set-option -g pane-active-border-fg colour049
set -g pane-active-border-bg default
# Enable native Mac OS X copy/paste
set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace $SHELL -l || exec $SHELL -l'"
# Allow the arrow key to be used immediately after changing windows
set-option -g repeat-time 0
# Fix to allow mousewheel/trackpad scrolling in tmux 2.1
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
# Disable assume-paste-time, so that iTerm2's "Send Hex Codes" feature works
# with tmux 2.1. This is backwards-compatible with earlier versions of tmux,
# AFAICT.
set-option -g assume-paste-time 0
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'Morantron/tmux-fingers'
# set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @continuum-boot 'on'
# set -g @continuum-restore 'on'
# set -g @continuum-boot-options 'iterm'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'jooize/tmux-powerline-theme'
# tmux yank
set -g @plugin 'tmux-plugins/tmux-yank'
set-option -g default-command "reattach-to-user-namespace -l $SHELL"
set -g @plugin 'tmux-plugins/tmux-copycat'
# Hit prefix + I to fetch and source the plugin. You should now be able to use the plugin!
# set -g @plugin 'tmux-plugins/tmux-sensible'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin '[email protected]/user/plugin'
# set -g @plugin '[email protected]/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# source "/usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf"
#
# Powerline theme
#
# Enable Powerline symbols (unless already specified otherwise in environment)
# https://github.com/jooize/tmux-powerline-theme#symbol-alternatives
if-shell ': ${TMUX_POWERLINE_SYMBOLS?}' '' 'set-environment -g TMUX_POWERLINE_SYMBOLS "unicode"'
# Toggle between Powerline and Unicode symbols with ^B P
bind-key P if-shell 'test $(echo "${TMUX_POWERLINE_SYMBOLS}") = "unicode"' 'set-environment -g TMUX_POWERLINE_SYMBOLS "powerline" ; run-shell "$HOME/.tmux/plugins/powerline-theme/powerline-theme.tmux"' 'set-environment -g TMUX_POWERLINE_SYMBOLS "unicode" ; run-shell "$HOME/.tmux/plugins/tmux-powerline-theme/powerline-theme.tmux"'
# Open process viewer
bind-key '~' split-window 'exec top'
# Command Line
set -g message-fg black
set -g message-bg green
set -g message-attr dim
# set -g allow-rename 0
# set -g automatic-rename 1
# set -g automatic-rename-format " #I:#{=30:pane_title}#F "
# set -g set-titles on
# set -g set-titles-string "#h:#S:#{pane_title} #{session_alerts}"