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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
# I got some additional config in 2022 from https://findelabs.com/post/openbsd-with-tmux/
# unbind some default keybindings
unbind C-b
#set-option -sa terminal-features ',screen-256color:RGB'
set-option -g focus-events on
# set shell
#set -g default-shell '/bin/ksh'
# paste with Ctrl Y
#bind-key -n C-y run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
unbind C-y
# command sequence for nested tmux sessions
bind-key a send-prefix
# fzf-nova
bind-key Tab capture-pane \; save-buffer /tmp/tmux-buffer \; delete-buffer \; display-popup -w 80% -h 60% -E "/home/lemon/src/fzf-nova/fzf-nova"
# Automatically copy selected text to PRIMARY and CLIPBOARD
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection-and-cancel\; run-shell -b "tmux show-buffer | xclip -selection primary -i && tmux show-buffer | xclip -selection clipboard -i"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X select-pane \; send-keys -X copy-selection-and-cancel\; run-shell -b "tmux show-buffer | xclip -selection primary -i && tmux show-buffer | xclip -selection clipboard -i"
# set prefix key to ctrl-a
set -g prefix C-a
set-option -g status-interval 60
# lower command delay
set -sg escape-time 1
# force tmux to use xterm
#set -g default-terminal "xterm-256color"
#set -g default-terminal "tmux-256color"
#set -g default-terminal "screen-256color"
# set from advice in neovim :checkhealth
#set-option -sa terminal-overrides ',screen-256color:RGB'
# start first window and pane at 1, not zero
set -g base-index 1
set -g pane-base-index 1
# bind r to reloading the config file
bind r source-file ~/.tmux.conf \; display "Reloaded tmux config file."
# pass through a ctrl-a if you press it twice
bind C-a send-prefix
# better mnemonics for splitting panes!
bind | split-window -h
bind - split-window -v
# vim / xmonad style bindings for pane movement
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
# vim / xmonad style bindings for window movement
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# history limit to 10K lines
set -g history-limit 10000
# shift-movement keys will resize panes
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
# make mouse useful in copy mode
set -g mouse on
# ctl-left/right keys
set-window-option -g xterm-keys on
# Configure Ctrl+Arrow keys to create and navigate through windows
bind -n C-Left previous-window
bind -n C-Right next-window
bind -n C-Up new-window
bind -n C-Down confirm-before -p "kill-window #P? (y/n)" kill-window
# Set visual notifications - these are quite nippy
setw -g monitor-activity off
set -g visual-activity off
# disable mouse support (at least while we're learning)
# setw -g mode-mouse off
# set -g mouse-select-pane off
# set -g mouse-resize-pane off
# set -g mouse-select-window off
#
# copy and paste
unbind p
bind p paste-buffer
#bind -t vi-copy 'v' begin-selection
#bind -t vi-copy 'y' copy-selection
# new copy and paste (needed for st terminal) = https://www.rushiagr.com/blog/2016/06/16/everything-you-need-to-know-about-tmux-copy-pasting-ubuntu/
# bind-key -T copy-mode-vi v send-keys -X begin-selection
# bind-key -T copy-mode-vi y send-keys -X copy-selection
# bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
# also copy to system clipboard
#bind -T vi-copy y copy-pipe "xclip -sel clip -i"
# enable copy and paste with the mouse!
set -g mouse off
# geohot colors
set -g status-position top
set -g status-bg colour234
set -g status-fg colour137
set -g status-style dim
set -g status-left ''
#set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
#set -g status-right '[#(TZ="Europe/London" date +"%%Y-%%m-%%d %%H:%%M")]'
set -g status-right "#(cat /tmp/gtd-tmux) %a %d/%m %I:%M %P"
set -g status-right-length 50
set -g status-left-length 20
## COLORSCHEME: gruvbox dark (medium) (stolen from github)
## from https://gitlab.com/herrhotzenplotz/unfoofed-dotfiles/-/blob/trunk/homedir/.tmux.conf?ref_type=heads
set-option -g status on
set-option -g status-style bg=colour237,fg=colour223 # bg=bg1, fg=fg1
set-window-option -g window-status-style bg=colour214,fg=colour237 # bg=yellow, fg=bg1
set-window-option -g window-status-activity-style bg=colour237,fg=colour248 # bg=bg1, fg=fg3
set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1
set-option -g pane-active-border-style fg=colour250 #fg2
set-option -g pane-border-style fg=colour237 #bg1
set-option -g message-style bg=colour239,fg=colour223 # bg=bg2, fg=fg1
set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=bg1
set-option -g display-panes-active-colour colour250 #fg2
set-option -g display-panes-colour colour237 #bg1
set-window-option -g clock-mode-colour colour109 #blue
set-window-option -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg
set-option -g status-justify "left"
set-option -g status-left-style none
set-option -g status-left-length "80"
set-option -g status-right-style none
set-option -g status-right-length "80"
set-window-option -g window-status-separator ""
set-option -g status-left "#[bg=colour241,fg=colour248] #S "
set-option -g status-right "#[bg=colour237,fg=colour239 nobold, nounderscore, noitalics] #[bg=colour239,fg=colour246] %Y-%m-%d %H:%M:%S #[bg=colour248,fg=colour237] #h #(/usr/home/nico/.local/bin/battery)"
set-window-option -g window-status-current-format "#[bg=colour214,fg=colour239] #I #[bg=colour214,fg=colour239,bold]#W#{?window_zoomed_flag,*Z,} "
set-window-option -g window-status-format "#[bg=colour239,fg=colour223] #I #[bg=colour239,fg=colour223]#W "
# setw -g window-status-current-style fg=colour81
# setw -g window-status-current-style bg=colour238
# setw -g window-status-current-style bold
# setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
# setw -g window-status-style fg=colour138
# setw -g window-status-style bg=colour235
# setw -g window-status-style none
# setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
# setw -g window-status-bell-style bold
# setw -g window-status-bell-style fg=colour255
# setw -g window-status-bell-style bg=colour1
# fiddle with colors of status bar
# set color for status bar
#set-option -g status-bg colour240
#set-option -g status-bg black
#set-option -g status-fg yellow
#set -g status-position bottom
#set -g status-style "bg=colour1"
#set -g status-style "fg=colour137"
##set -g status-fg colour137
##set -g status-attr dim
##set -g status-left ''
#set -g status-left-length 30
#set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
##set -g status-right-length 5
##set -g status-left-length 20
# show hostname and IP address on the left side of status bar
#set-option -g status-left-length 100
#set -g status-left ' #( sysctl -n vm.loadavg ) ' - this isn't useful
# show session name, window, pane number, date and time on right side
set -g status-right-length 100
##setw -g window-status-current-bg colour238
##setw -g window-status-current-style bold
#setw -g window-status-current-format ' #[bg=colour237]#I#[fg=colour250]:#[fg=colour255]#[bg=colour237]#W#[fg=colour50]#F '
##
#setw -g window-status-style "fg=colour61"
#setw -g window-status-style "bg=colour235"
#setw -g window-status-attr none
#setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
#
#setw -g window-status-bell-attr bold
#setw -g window-status-bell-fg colour255
#setw -g window-status-bell-bg colour1
##
## fuck with border colours
#set -g pane-border-fg yellow
#set -g pane-active-border-fg red
#
#
## fiddle with colors of inactive windows
#setw -g window-status-fg cyan
# vim mode keys
setw -g mode-keys vi
# battery information in status bar
set -g status-interval 40
#set -g status-right "#[fg=colour155]#(apm -l)%% | #[fg=colour45]%d %b %R"
#
## Smart pane switching with awareness of Vim splits.
## See: https://github.com/christoomey/vim-tmux-navigator
#is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
#bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
#bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
#bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
#bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
#tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
#if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
# "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
#if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
# "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
#
#bind-key -T copy-mode-vi 'C-h' select-pane -L
#bind-key -T copy-mode-vi 'C-j' select-pane -D
#bind-key -T copy-mode-vi 'C-k' select-pane -U
#bind-key -T copy-mode-vi 'C-l' select-pane -R
#bind-key -T copy-mode-vi 'C-\' select-pane -l
#
#
# try different, vimlike copy-mode
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
#List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
#set -g @plugin 'tmux-plugins/tmux-yank'
set -g @resurrect-save 'Q'
set -g @resurrect-restore 'R'
run-shell ~/.tmux-resurrect/resurrect.tmux
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
|