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
|
# I got some additional config in 2022 from https://findelabs.com/post/openbsd-with-tmux/
# unbind some default keybindings
unbind C-b
# set shell
set -g default-shell '/usr/local/bin/fish'
# command sequence for nested tmux sessions
bind-key a send-prefix
# 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"
# geohot colors
set -g status-position bottom
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-length 50
set -g status-left-length 20
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'
|