-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
129 lines (104 loc) · 4.37 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
set-option -q prefix C-b
set -s escape-time 0
set -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"
set-option -sa terminal-overrides ",xterm-kitty:RGB"
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xsel -i -p'
bind-key 'C-z' resize-pane -Z
# more vim-like word boundaries in copy mode
set -g word-separators "<>(){}[]/'\";@*+,.-_=!£$%^&:#~?`¬|\\ "
set -g mouse on
set -g history-limit 5000000
set -g status-interval 1
set -g monitor-activity on
set -g visual-activity on
set -g set-titles on
set -g set-titles-string "#W (#h)"
set -g base-index 1
setw -g pane-base-index 1
set -g lock-command vlock
set -g status-keys vi
setw -g mode-keys vi
bind r source-file ~/.tmux.conf \; display "Reloaded config."
set -g status-left-length 25
set -g status-justify centre
# change window screen colors
set-option -wg mode-style bg="#FE8019",fg="#3C3836"
# default statusbar colors (terminal bg should be #282828)
set-option -g status-style bg=terminal,fg="#A89984"
# default window title colors
set-option -wg window-status-style bg="#3C3836",fg="#bdae93"
# colors for windows with activity
set-option -wg window-status-activity-style bg="#3C3836",fg="#bdae93"
# colors for windows with bells
set-option -wg window-status-bell-style bg="#3C3836",fg="#FE8019"
# active window title colors
set-option -wg window-status-current-style bg="#a89984",fg="#282828"
# pane border
set-option -g pane-active-border-style fg="#FE8019"
set-option -g pane-border-style fg="#3C3836"
# message info
set-option -g message-style bg="#FE8019",fg="#3C3836"
# writing commands inactive
set-option -g message-command-style bg="#A89984",fg="#3C3836"
# pane number display
set-option -g display-panes-active-colour "#FE8019"
set-option -g display-panes-colour "#3C3836"
# clock
set-option -wg clock-mode-colour "#FE8019"
# copy mode highlighting
%if #{>=:#{version},3.2}
set-option -wg copy-mode-match-style "bg=#A89984,fg=#3C3836"
set-option -wg copy-mode-current-match-style "bg=#FE8019,fg=#3C3836"
%endif
# statusbar formatting
set-option -g status-left "#[bg=#a89984, fg=#282828] #(whoami)@#H "
set-option -g status-right "#[bg=#a89984, fg=#282828] #{session_name} "
set-option -wg window-status-current-format " #{window_index}#{window_flags} #{window_name} "
set-option -wg window-status-format " #{window_index}#{window_flags} #{window_name} "
# 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
bind-key "U" run -b "\
tmux capture-pane -J -p -S -2000 \
| grep -oP '[^\]\[\s\(\){}=$\\'\\''\\\"\\t ]{4,}' \
| awk '!x[$0]++' \
| sed '1!G;h;$!d' \
| nl -w3 -s ' ' \
| fzf-tmux -d 35% -m -0 --no-preview --no-border \
| awk '{print $2}' \
| xargs tmux set-buffer || true";
bind-key "u" run -b "\
tmux capture-pane -J -p -S -2000 \
| grep -oP '[^\]\[\s\(\){}=$\\'\\''\\\"\\t ]{4,}' \
| awk '!x[$0]++' \
| sed '1!G;h;$!d' \
| nl -w3 -s ' ' \
| fzf-tmux -d 35% -m -0 --no-preview --no-border \
| awk '{print $2}' \
| xargs tmux set-buffer && tmux paste-buffer || true";
bind-key -n "F9" {
set-option -q prefix none
set-option -g status-left "#[bg=#a89984, fg=#282828] (SUSPENDED) #(whoami)@#H "
bind-key -n "F9" {
source-file ~/.tmux.conf
display "Resumed"
}
}