-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
175 lines (145 loc) · 6.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
# plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-copycat'
# Note that the tmux-notify plugin checks process termination very natively, it
# checks that the pane contents end with: $, therefore if the process has not
# completed but happens to print out a single $, then it'll notify.
set -g @plugin 'rickstaa/tmux-notify'
set -g @plugin 'akohlbecker/aw-watcher-tmux'
# plugin configuration
set -g @prefix_highlight_show_copy_mode 'on'
# Include additional information about the pane in the notification
set -g @tnotify-verbose 'on'
set -g @tnotify-verbose-title 'Task Completed'
set -g @tnotify-verbose-msg 'Session: #S > Window: #W[#I] > Pane: #P'
set -g @tnotify-custom-cmd '"${HOME}/bin/tmux-notify" "Task Completed" "$(tmux display-message -t \$${SESSION_ID}:@${WINDOW_ID}.${PANE_ID} -p "Session: #{session_name} \> Window: #{window_name}\[#{window_index}\] \> Pane: #{pane_index}")"; tmux switch-client -t %${PANE_ID}'
# Scan the processes every N seconds
set -g @tnotify-sleep-duration '3'
# modern colorized configuration
set -s default-terminal "xterm-256color"
# panes
set -g pane-border-style 'fg=#555555'
set -g pane-active-border-style '#{?pane_in_mode,fg=#AAAAAA,#{synchronize-panes,fg=red,fg=green}}'
# status bar design
set -g status-justify 'left'
set -g status-style 'fg=#888888,bg=#121210'
set -g status-interval 2
# messaging
set -g message-style 'fg=black,bg=white,bright'
set -g message-command-style 'fg=blue,bg=#121210'
# window mode (doesn't work?)
setw -g mode-style 'fg=#121212,bg=colour250'
# window status
setw -g window-status-bell-style 'bright'
setw -g window-status-activity-style 'bg=#8888c3,fg=#121210'
setw -g window-status-separator ''
setw -g window-status-current-style 'fg=#121212,bg=#ffffff,bright'
setw -g window-status-current-format \
'#[fg=#121210]#I#[fg=#ffffff,bg=#121212]#[fg=#c6d406] #W#[fg=reverse,bg=reverse]#{p3:window_flags}'
setw -g window-status-style 'fg=#121210,bg=#a0a09d,none'
setw -g window-status-format \
'#I#[reverse]#[bg=reverse,fg=#aaaaaa] #W#[reverse]#{p3:window_flags}'
# info on left
set -g status-left '#S'
set -g status-left-length 15
set -g status-left-style 'fg=#888888,bg=#121210,bright'
# info on right
# set -g status-style 'dim'
set -g status-position bottom
set -g status-right-style 'bright'
set -g status-right \
'#{USER} #{prefix_highlight}#[reverse] %d/%m #[default,bold] %H:%M:%S'
set -g status-right-length 50
# Pop-up styles
set -g popup-border-lines 'rounded'
# Menu styles
set -g menu-border-lines 'rounded'
set -g pane-border-lines 'heavy'
set -g pane-border-indicators 'both'
set -g pane-border-status 'off'
# TMUX behavior
set -g renumber-windows 'on'
# Shell Integration
set -g allow-passthrough on
set -g allow-rename on
# TODO: Determine if we want - and _ to be word separators, so far, experience says no.
set -g word-separators ' @"=()[]/'
set -ag word-separators "'"
set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
set -g history-limit 50000
set -g base-index 1
set -g focus-events on
setw -g mode-keys emacs
setw -g xterm-keys on
setw -g mouse on
# Window Activity Configuration
setw -g monitor-activity on
setw -g visual-activity off
# Bell configuration
setw -g monitor-bell off
setw -g bell-action any
setw -g visual-bell on
bind-key -n M-R source-file "${HOME}/.tmux.conf" \; display-message "sourced ${HOME}/.tmux.conf"
# Pane navigation
bind-key -n M-S-Up select-pane -U
bind-key -n M-S-Down select-pane -D
bind-key -n M-S-Left select-pane -L
bind-key -n M-S-Right select-pane -R
bind-key w display-panes
# Window navigation
bind-key -n "C-PPage" select-window -t :-
bind-key -n "C-NPage" select-window -t :+
# Session naviagation
bind-key -n "M-PPage" switch-client -p
bind-key -n "M-NPage" switch-client -n
# Pane manipulation
bind-key - split-window -v -c "#{pane_current_path}"
bind-key M-- select-layout even-vertical
bind-key \\ split-window -h -c "#{pane_current_path}"
bind-key M-\\ select-layout even-horizontal
unbind-key M-Down
bind-key M-Down swap-pane -D
unbind-key M-Up
bind-key M-Up swap-pane -U
unbind-key M-Left
bind-key M-Left swap-window -t:-
unbind-key M-Right
bind-key M-Right swap-window -t:+
bind-key q confirm-before kill-pane
bind-key Q confirm-before kill-window
bind-key C-q confirm-before kill-pane
# Pop-up Window
bind-key N if-shell -F '#{==:#{session_name},scratch}' {
detach-client
} {
display-popup -E "tmux new-session -A -s scratch"
}
# Session management
bind-key S command-prompt -I "#S" "rename-session '%%'"
bind-key C-j display-popup -w 90% -h 90% -E "${HOME}/scripts/tmux-session-switcher.sh
"
# Put the tmux copy buffer into the clipboard
set -g set-clipboard on
# Looks like extkeys breaks shift+tab in some cases, so it has been removed.
set-option -g "terminal-features[2]" "wezterm*:256:bpaste:ccolour:clipboard:cstyle:focus:margins:mouse:overline:rectfill:RGB:strikethrough:title:usstyle"
set-option -g "terminal-features[2]" "xterm-256color*:clipboard:ccolour:cstyle:focus:title:mouse:usstyle:strikethrough:RGB:rectfill:overline:margins:extkeys:256"
bind-key C-y paste-buffer
unbind-key -T copy-mode C-c
bind-key C-b run-shell -b "tmux show-buffer | perl -pe 'chomp if eof' | /usr/bin/xclip -sel clip && tmux display-message 'Copied to system clipboard'"
bind-key M-b run-shell -b "tmux show-buffer | perl -pe 'chomp if eof' | ~/bin/copy-to-remote-clipboard && tmux display-message 'Copied to remote clipboard'"
bind-key -T copy-mode C-c send -X copy-pipe '/usr/bin/xclip -in -selection clipboard; tmux display-message "Copied to system clipboard"'
bind-key -T copy-mode M-w send -X copy-pipe '~/bin/copy-to-remote-clipboard; tmux display-message "Copied to remote clipboard"'
# Ctrl+; does not seem to work in tmux, there are possible solutions:
# a) bind prefix + ; to Ctrl+;
# unbind-key \;
# bind-key \; send-keys C-\\;
# b) bind Alt+; to Ctrl+;
# It is easier to use Ctrl+x Ctrl+[a->;] because I don't need to swap
# between pressing Ctrl and Alt
# bind-key -n M-\; send-keys C-\\;
# c) execute tmux send-keys C-\; directly from xbindkeys when Ctrl+; is pressed
if-shell "[[ -e ${HOME}/modules/tpm/tpm ]]" "run ${HOME}/modules/tpm/tpm"