-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
211 lines (168 loc) · 7.16 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
## Keybindings
# Make it use C-a, similar to screen..
unbind C-b
set -g prefix C-a
# neovim +checkhealth
set-option -sa terminal-overrides ',XXX:RGB' # true colors
set-option -g focus-events on
# Integrate with system clipboard
set -g set-clipboard on
# GNU Screen's last window
bind-key C-a last-window
# Reload key
bind r source-file ~/.tmux.conf \; display "Sourced!"
# vi keybindings
set -g status-keys vi
setw -g mode-keys vi
# Copy mouse selection to clipboard
if-shell "uname | grep -q Darwin" "bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'" "bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'"
# Synchronize input to all panes in a window for parallel input
#bind S set-window-option synchronize-panes on
#bind ^s set-window-option synchronize-panes off
# save scrollback buffer
bind-key O command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# screen monitor for activity
bind M setw monitor-activity on
bind m setw monitor-activity off
set -g visual-activity on
# prev / next
bind -n F11 previous-window
bind -n F12 next-window
bind -n S-F11 select-pane -t :.-
bind -n S-F12 select-pane -t :.+
# rotate panes
#bind -n F9 rotate-window
bind -n C-F11 rotate-window -D
bind -n C-F12 rotate-window -U
# resize panes
bind -r K resize-pane -U 5
bind -r J resize-pane -D 5
bind -r H resize-pane -L 5
bind -r L resize-pane -R 5
# move around panes
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -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"
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
# switch windows alt+number
bind-key -n M-0 select-window -t 0
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# Interactively select session
bind - choose-session
bind o switch-client -l # last session
bind _ switch-client -l # last session
bind N switch-client -n # next session
bind P switch-client -p # prev session
# split windows
bind i split-window -h # horizontal
bind s split-window # vertical
# access a session thats inside another session with C-a a <command> (or for use in other programs that use C-a)
bind a send-prefix
# zsh ftw
#set -g default-shell /usr/bin/zsh # XXX: breaks osx
# set only on OS X where it's required
#set -g default-command "tmux rename-window x; reattach-to-user-namespace -l $SHELL"
# Makes quick keystrokes work.
set -s escape-time 0 # address vim mode switching delay (http://superuser.com/a/252717/65504)
set -sg repeat-time 300
# start window indexing at one
set -g base-index 1
set-window-option -g pane-base-index 1 # for tmuxinator
# Windows are only as small as the smallest VIEWING the window (not the smallest actually connected to the session)
setw -g aggressive-resize on
# disable wm window titles
set -g set-titles off
# https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6
# set -g default-terminal "xterm-256color"
set -g default-terminal "tmux-256color"
if 'infocmp -x alacritty > /dev/null 2>&1' 'set -g default-terminal "alacritty"'
set -ag terminal-overrides ",alacritty:RGB"
set -g history-limit 10000
# Maximum number of paste buffers
set -g buffer-limit 20
# Do not automatically set window name to running command
setw -g automatic-rename off
# THEME
# status bar
#set -g status-bg '#000000'
#set -g status-fg blue
#set -g status-interval 60
#set -g status-left-length 30
#set -g status-left '#[fg=red]#S #[fg=blue]#(whoami)@#H#[default]'
#set -g status-right '#[fg=yellow]#[default] #[fg=blue]%l:%M#[default]'
#set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=blue]%l:%M#[default]'
#set -g status-right '#[fg=blue]#(cut -d " " -f 2-3 /proc/loadavg) | #[fg=blue]%m-%d | %H:%M#[default] '
#set -g status-right "CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M "
#set -g status-right "#[fg=blue]#(~/.tmux/spotify-current-track.sh) #[fg=red]::#[fg=brightblue] #[bold]%d#[nobold] %b #[fg=red]::#[fg=brightblue]%l.%M %p "
# other
set-option -g -q mouse on
# autocopy parent environment vars to new shells (i.e. ssh-agent vars)
set -g update-environment -r # breaks vmux and show-environment(?), but fixes lost ssh-agent (i.e. SSH_AUTH_SOCK tmp file changes)
# parens around current window
set-window-option -g window-status-current-format "(#I:#W)"
# for neovim
set -g @resurrect-strategy-nvim 'session'
# tokyonight theme
# Undercurl
set -g default-terminal "${TERM}"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
# local tmux
source ~/.tmux.conf.local
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'richin13/tmux-plugin-playerctl'
run-shell ~/.tmux/plugins/tmux-plugin-playerctl/playerctl.tmux
set -g @plugin 'tmux-plugins/tmux-yank' # yank to system clipboard
set -g @plugin 'fcsonline/tmux-thumbs' # prefix + space
set -g @plugin 'roosta/tmux-fuzzback' # prefix + ?
set -g @plugin 'wfxr/tmux-fzf-url' # prefix + u
set -g @plugin 'jonaustin/tmux-pomodoro-plus' # prefix + (p P C-p alt-p)
set -g @pomodoro_on " "
set -g @pomodoro_notifications 'on'
set -g @fuzzback-popup 1
set -g @fuzzback-popup-size '90%'
set -g @resurrect-save 'S'
set -g @resurrect-restore 'R'
set -g @resurrect-strategy-nvim 'session'
set -g @continuum-restore 'on' # automatically restore on tmux start?
#set -g @continuum-boot-options 'iterm' # automatically start iterm/tmux on login
# Initializes TMUX plugin manager.
# Keep this line at the very bottom of tmux.conf.
run -b '~/.tmux/plugins/tpm/tpm'
# tokyonight theme
run -b '~/.tmux/tokyonight-powerline.sh'
# Tips
# c-a z -- toggle pane maximized
# Open new session and change visible window without affecting original session:
## tmux new-session -t 'original session name or number'
# make height/width of panes equal (like vim's C-W =)
## c-a alt-5 --- select-layout tiled
## c-a alt-1 --- select-layout even-horizontal
## c-a alt-2 --- select-layout even-vertical
## c-a space --- cycle between all layouts