-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.tmux.conf
223 lines (167 loc) · 6.3 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
219
220
221
222
223
# Colour Helper
# for i in {0..255}; do printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\n"; done
#
###########################################################################
# Change prefix from default (C-b) to C-Space
# unbind C-b
set -g prefix C-Space
#bind Space send-prefix
# send the prefix to client inside window (nested sessions like overmind)
# this may conflict with 1password's autofill
bind-key -n 'C-\' send-prefix
###########################################################################
# General options
# Bump history limit
set -g history-limit 16348
# Notifying if other windows has activities
setw -g monitor-activity off
set -g visual-activity off
set-option -g set-titles on
# 0 is too far
set -g base-index 1
setw -g pane-base-index 1
# Window Ordering
set-option -g renumber-windows on
# shorten command delay
set -s escape-time 1
###########################################################################
# General keymap
# `+r reloads the configuration, handy
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Clear Screen
bind C-l send-keys 'C-l'
# Custom status bar
# Powerline symbols:
# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"
###########################################################################
## Status Bar
set -g status on
set -g status-position bottom
set -g status-interval 5
set -g status-justify left
set -g status-left-length 32
set -g status-right-length 150
# set the status line's colors
set -g status-style fg=white,bg=black
# set colors for the active window
setw -g window-status-current-style fg=white,bold,bg=red
set -g status-bg colour234
set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold] #[default]'
set -g status-right "#[fg=colour245]| %R | #(TZ="UTC" date +%%H:%%M) UTC | %Y-%m-%d #[fg=colour254,bg=colour234,nobold]#[fg=colour16,bg=colour254,bold] #h "
set -g window-status-format "#[fg=white,bg=colour234] #I #W "
set -g window-status-current-format "#[fg=colour234,bg=colour39]#[fg=colour16,bg=colour39,noreverse,bold] #I | #W #[fg=colour39,bg=colour234,nobold] #{?window_zoomed_flag,#[fg=colour206] #[fg=white]#[bg=colour206]<<< ZOOM >>>#[fg=colour206]#[bg=colour234] ,}"
# Update the status line every sixty seconds
set -g status-interval 60
# Center the window list in the status line
set -g status-justify centre
unbind l
#bind C-a last-window
# screen habit
bind C-c new-window
# Copy mode
unbind [
bind Space copy-mode
bind C-Space copy-mode
# Use Vi mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind -T copy-mode-vi 'v' send -X begin-selection
bind -T copy-mode-vi 'y' send -X copy-selection
bind -T copy-mode-vi 'Y' send -X copy-end-of-line
bind -T copy-mode-vi 'V' send -X copy-rectangle-toggle
unbind p
bind p paste-buffer
bind -T copy-mode-vi y send -X copy-pipe "pbcopy"
bind C-c run "tmux save-buffer - | pbcopy"
bind C-v run \
"tmux set-buffer \"$(pbpaste)\"; tmux paste-buffer"
# Update default binding of `Enter` to also use copy-pipe
# unbind -t vi-copy Enter
# bind -T copy-mode-vi Enter send -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"
unbind p
bind p paste-buffer
# Make mouse useful in copy mode
set -g mouse on
###########################################################################
# Pane management / navigation
# More straight forward key bindings for splitting
unbind %
bind | split-window -v
bind h split-window -v
unbind '"'
bind - split-window -h
bind v split-window -h
bind e previous-window
bind f next-window
# Window 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
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# vim-tmux-navigator and fzf
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"
# Zoooom
bind-key Up resize-pane -Z
bind-key Down resize-pane -Z
###########################################################################
# tmux-resurrect plugin
# for vim
set -g @resurrect-strategy-vim 'session'
# for neovim
set -g @resurrect-strategy-nvim 'session'
# restore pane contents
#set -g @resurrect-capture-pane-contents 'on'
###########################################################################
# os specific files
# Load mac-specific settings
# if-shell "uname | grep -q Darwin" "source-file ~/.tmux.mac.conf"
# load private settings if they exist
if-shell "[ -f ~/.tmux.private]" "source ~/.tmux.private"
###########################################################################
# direnv
#set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES"
#set-environment -gu DIRENV_DIFF
#set-environment -gu DIRENV_DIR
#set-environment -gu DIRENV_WATCHES
#set-environment -gu DIRENV_LAYOUT
###########################################################################
# TMUX plugin manager
# List of plugins
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-continuum \
tmux-plugins/tmux-yank \
'
#tmux-plugins/tmux-urlview \
#tmux-plugins/tmux-yank \
#tmux-plugins/tmux-copycat \
#tmux-plugins/tmux-fpp \
#tmux-plugins/tmux-sessionist \
#tmux-plugins/tmux-logging \
#tmux-plugins/tmux-sidebar \
#tmux-plugins/tmux-open \
#nhdaly/tmux-scroll-copy-mode \
#tmux-plugins/tmux-sensible \
#tmux-plugins/tmux-resurrect \
# Initializes TMUX plugin manager.
# Keep this line at the very bottom of tmux.conf.
run -b '~/.tmux/plugins/tpm/tpm'