-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
218 lines (163 loc) · 6.81 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
###########################
### TMUX PLUGIN MANAGER ###
###########################
# List of plugins
# To set up the plugins and Tmux Plugin Manager:
# 1. git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# 2. Start tmux
# 3. Press prefix + shift + I to install
# 4. Press prefix + r to restart tmux
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
# Unsupported in latest Tmux, see: https://github.com/NHDaly/tmux-better-mouse-mode/issues/29
# set -g @plugin 'nhdaly/tmux-better-mouse-mode'
# set -g @plugin 'christoomey/vim-tmux-navigator'
######################
### BASIC SETTINGS ###
######################
# Hide the status bar. Use prefix+w and prefix+s for jumping around instead of visually.
set -g status on
# # make tmux display things in 256 colors
set -g terminal-overrides ',xterm-256color:Tc'
set -g default-terminal "xterm-256color"
set -as terminal-overrides ',xterm*:sitm=\E[3m'
# # set scrollback history to 10000 (10k)
set -g history-limit 10000
# # shorten command delay
set -sg escape-time 2
# # set window and pane index to 1 (0 by default)
set-option -g base-index 1
setw -g pane-base-index 1
# # Make the current window the first window
bind T swap-window -t 1
# # use PREFIX | to split window horizontally and PREFIX - to split vertically
bind | split-window -h
bind - split-window -v
# # resize panes using PREFIX H, J, K, L
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
set -g mouse on
# Automatically rename Tmux pane to current folder path, but respect any name you've manually set
set-option -g status-interval 3
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'
# Allows mouse scrolling still in Vim if you do e.g. set mouse=i
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# Copy to system clipboard when copying with mouse
set-option -g default-command "reattach-to-user-namespace -l $SHELL"
# Fix issue with Kitty terminal where Tmux copy ends up appending versus replacing clipboard contents
# https://github.com/kovidgoyal/kitty/issues/782
bind-key -T copy-mode-vi y if-shell "test ! -z $KITTY_WINDOW_ID" "send-keys -X copy-pipe 'kitty +kitten clipboard'" "send-keys -X copy-pipe 'pbcopy'"
# Fixes attaching to system clipboard on OSX High Sierra
# https://medium.freecodecamp.org/tmux-in-practice-integration-with-system-clipboard-bcd72c62ff7b
# TODO: if opening multiple windows, this seems to prevent standard error from showing in those new windows
# if -b "command -v reattach-to-user-namespace > /dev/null 2>&1" \
# "run 'tmux set -g default-command \"exec $(tmux show -gv default-shell) 2>/dev/null & reattach-to-user-namespace -l $(tmux show -gv default-shell)\"'"
# Vi mode
# To copy: c-[, h/j/k/l, v, y. Then prefix-] to paste anywhere in Tmux.
setw -g mode-keys vi
set -g status-keys vi
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# Shift arrow to switch windows
bind -n S-right next-window
bind -n S-left previous-window
# Enter
bind -n C-s copy-mode \; send-keys -X halfpage-up
# bind -n C-x copy-mode \; send-keys -X halfpage-down " Interferes with Vim C-x
# bind -n C-d copy-mode \; send-keys -X halfpage-down " Interferes with Vim C-x
bind r source-file ~/.tmux.conf
# Don't prompt about killing windows or panes
bind-key & kill-window
bind-key x kill-pane
bind-key c-x kill-pane
######################
# VIM KEYS ###########
######################
# allow FZF to use J/K
######################
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
bind -n C-h run "($is_vim && tmux send-keys C-h) || \
tmux select-pane -L"
bind -n C-j run "($is_vim && tmux send-keys C-j) || \
($is_fzf && tmux send-keys C-j) || \
tmux select-pane -D"
bind -n C-k run "($is_vim && tmux send-keys C-k) || \
($is_fzf && tmux send-keys C-k) || \
tmux select-pane -U"
bind -n C-l run "($is_vim && tmux send-keys C-l) || \
tmux select-pane -R"
# bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
####################
# DESIGN CHANGES ###
####################
# panes
set -g pane-border-style fg=black
set -g pane-active-border-style fg=brightred
## Status bar design
# status line
set -g status-justify left
set -g status-style fg=colour12,bg=default
set -g status-interval 2
# messaging
set -g message-style fg=black,bg=yellow
set -g message-command-style fg=blue,bg=black
#window mode
setw -g mode-style fg=colour0,bg=colour6
# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
setw -g window-status-current-style fg=colour11,bg=colour0,dim
setw -g window-status-style fg=black,bg=green,reverse
# Info on left (I don't have a session display for now)
set -g status-left ''
# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none
set -g default-terminal "screen-256color"
# set -g default-terminal "term-256color"
# set -g default-terminal "xterm"
# The modes {
setw -g clock-mode-colour colour135
setw -g mode-style fg=colour196,bg=colour238,bold
# }
# The panes {
set -g pane-border-style fg=colour238,bg=colour235
set -g pane-active-border-style fg=colour51,bg=colour236
# }
# The statusbar {
set -g status-position bottom
set -g status-style fg=colour137,bg=colour234,dim
set -g status-left ''
# This includes date and time:
# set -g status-right '#[fg=colour233,bg=colour70,bold] %a %m/%d #[fg=colour233,bg=colour75,bold] %I:%M %p '
set -g status-right ''
set -g status-right-length 0
set -g status-left-length 0
setw -g window-status-current-style fg=colour81,bg=colour238,bold
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
setw -g window-status-style fg=colour138,bg=colour235
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
setw -g window-status-bell-style fg=colour255,bg=colour1,bold
# }
# The messages {
set -g message-style fg=colour232,bg=colour166,bold
# }
set -g default-command /usr/local/bin/fish
set -g default-shell /usr/local/bin/fish
# Create new Tmux session from within an existing one with {cmd+b, C}
bind C new
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'