-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux.conf
More file actions
152 lines (125 loc) · 6.02 KB
/
tmux.conf
File metadata and controls
152 lines (125 loc) · 6.02 KB
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
# set -g status-bg 'colour10'
# prefix = C-a unless we're over ssh
if-shell 'test -z "$SSH_CONNECTION"' \
'set-option -g prefix C-a'\
'set-option -g prefix C-b; set status-style "bg=red"' #; bind-key C-b last-window; bind-key b send-prefix'
# We still want to be able to send C-a to apps, i.e. vim
bind C-a send-keys C-a # FIXME: This doesn't work in spin
# Longer scrollback
set-option -g history-limit 5000
# Get some colors
# set-option -ga terminal-overrides ',xterm-256color:Tc'
# set -g default-terminal "screen-256color"
set -g default-terminal "${TERM}"
set -as terminal-features ",*:RGB"
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
##### Colors
# TokyoNight colors for Tmux
set -g mode-style "fg=#82aaff,bg=#3b4261"
set -g message-style "fg=#82aaff,bg=#3b4261"
set -g message-command-style "fg=#82aaff,bg=#3b4261"
set -g pane-border-style "fg=#3b4261"
# Auto-detect dark/light mode and set active border color accordingly
if-shell "defaults read -g AppleInterfaceStyle 2>/dev/null | grep -q Dark" \
'set -g pane-active-border-style "fg=#ff8770,bold"' \
'set -g pane-active-border-style "fg=#ff7339,bold"'
set -g status "on"
set -g status-justify "left"
set -g status-style "fg=#82aaff,bg=#1e2030"
set -g status-left-length "100"
set -g status-right-length "100"
set -g status-left-style NONE
set -g status-right-style NONE
set -g status-left "#[fg=#1b1d2b,bg=#82aaff,bold] #S #[fg=#82aaff,bg=#1e2030,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#1e2030,bg=#1e2030,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#1e2030] #{prefix_highlight} #[fg=#3b4261,bg=#1e2030,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#3b4261] %Y-%m-%d %I:%M %p #[fg=#82aaff,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#1b1d2b,bg=#82aaff,bold] #h "
if-shell '[ "$(tmux show-option -gqv "clock-mode-style")" == "24" ]' {
set -g status-right "#[fg=#1e2030,bg=#1e2030,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#1e2030] #{prefix_highlight} #[fg=#3b4261,bg=#1e2030,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#3b4261] %Y-%m-%d %H:%M #[fg=#82aaff,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#1b1d2b,bg=#82aaff,bold] #h "
}
setw -g window-status-activity-style "underscore,fg=#828bb8,bg=#1e2030"
setw -g window-status-separator ""
setw -g window-status-style "NONE,fg=#828bb8,bg=#1e2030"
setw -g window-status-format "#[fg=#1e2030,bg=#1e2030,nobold,nounderscore,noitalics]#[default] #I #W #F #[fg=#1e2030,bg=#1e2030,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#1e2030,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#82aaff,bg=#3b4261,bold] #I #W #F #[fg=#3b4261,bg=#1e2030,nobold,nounderscore,noitalics]"
# tmux-plugins/tmux-prefix-highlight support
set -g @prefix_highlight_output_prefix "#[fg=#ffc777]#[bg=#1e2030]#[fg=#1e2030]#[bg=#ffc777]"
set -g @prefix_highlight_output_suffix ""
#####
# Disable Esc timer
set -s escape-time 0
# Forward extended/modified key sequences (CSI u / Kitty keyboard protocol)
# so TUI apps like pi can distinguish e.g. Shift+Enter from plain Enter
set -s extended-keys on
set -as terminal-features 'xterm*:extkeys'
# Housekeeping
set -g base-index 1
set -g mouse on
# set -g prefix2 None
set -g repeat-time 200
set -g visual-bell off
set -g visual-silence off
set-option -g focus-events on
# Vim movement
# vim-like pane resizing
bind -r C-K resize-pane -U 10
bind -r C-J resize-pane -D 10
bind -r C-H resize-pane -L 10
bind -r C-L resize-pane -R 10
# vim-like pane switching
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# and now unbind keys
unbind Up
unbind Down
unbind Left
unbind Right
unbind C-Up
unbind C-Down
unbind C-Left
unbind C-Right
# Esc is applied right away
set -sg escape-time 0
# When creating new windows or splits, keep the cwd
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Smart pane switching with awareness of vim splits
# Taken from https://github.com/rygwdn/dotfiles/blob/master/tmux.conf#L78-L108
contains_nested_or_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$" || echo "#{pane_title}" | grep -iqE "^(vim\[.*\]$|tmux-ssh)"'
bind -n C-h if-shell "$contains_nested_or_vim" "send-keys C-h" {
if-shell 'test "#{pane_at_left}" = 1 -a -n "$SSH_CONNECTION" -a -S /tmp/tmux-host-socket' \
{run-shell 'tmux -S /tmp/tmux-host-socket select-pane -L'} \
"select-pane -L"
}
bind -n C-j if-shell "$contains_nested_or_vim" "send-keys C-j" {
if-shell 'test "#{pane_at_bottom}" = 1 -a -n "$SSH_CONNECTION" -a -S /tmp/tmux-host-socket' \
{run-shell 'tmux -S /tmp/tmux-host-socket select-pane -D'} \
"select-pane -D"
}
bind -n C-k if-shell "$contains_nested_or_vim" "send-keys C-k" {
if-shell 'test "#{pane_at_top}" = 1 -a -n "$SSH_CONNECTION" -a -S /tmp/tmux-host-socket' \
{run-shell 'tmux -S /tmp/tmux-host-socket select-pane -U'} \
"select-pane -U"
}
bind -n C-l if-shell "$contains_nested_or_vim" "send-keys C-l" {
if-shell 'test "#{pane_at_right}" = 1 -a -n "$SSH_CONNECTION" -a -S /tmp/tmux-host-socket' \
{run-shell 'tmux -S /tmp/tmux-host-socket select-pane -R'} \
"select-pane -R"
}
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'laktak/extrakto'
set -g @plugin 'christoomey/vim-tmux-navigator'
# TODO: Also export custom theme to dotfiles
# set -g @plugin 'erikw/tmux-powerline'
# Initialize Tmux Package Manager
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
run -b '~/.tmux/plugins/tpm/tpm'
# Make tmux restore the last saved session on start
set -g @continuum-restore 'on'