-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_tmux.conf.tmpl
183 lines (147 loc) · 5.91 KB
/
dot_tmux.conf.tmpl
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
# vim:ft=tmux
set -g history-limit 10000
set -g base-index 1
set -sg escape-time 0
set -g allow-rename off
set -g default-command ""
set -g default-terminal "${TERM}"
if-shell '[ $TERM = "xterm-kitty" ]' {
set -sa terminal-overrides ',xterm-256color: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
} {
set -g default-terminal "xterm-256color"
set -sa terminal-overrides ',xterm-256color:RGB'
}
set -g mode-keys vi
set -g focus-events on
# Source local config file - if it exists
source-file -q "$HOME/.tmux.local.conf"
# Unset theme should defualt to dark
if-shell '[ $($HOME/.local/bin/term-theme echo) = "light" ]' {
source-file -q "$HOME/.tmux/themes/catppuccin_latte.conf"
} {
source-file -q "$HOME/.tmux/themes/catppuccin_frappe.conf"
}
source-file -q "$HOME/.tmux/theme.conf"
# New window at current path
bind > new-window -c "#{pane_current_path}"
# Run commands across all panes
bind a set-window-option synchronize-panes
# Pane layout options
bind ! select-layout even-vertical # Shift + 1
bind @ select-layout even-horizontal # Shift + 2
# Toggle mouse on
bind-key M \
set-option -g mouse on \;\
display-message 'Mouse: ON'
# Toggle mouse off
bind-key m \
set-option -g mouse off \;\
display-message 'Mouse: OFF'
# Window navigation (mac like replaces iTerms tab navigation)
bind -n "M-{" prev # Send HEX Code: 0x02 0x70
bind -n "M-}" next # Send HEX Code: 0x02 0x6E
# Fullscreen pane toggle
bind -n C-x resize-pane -Z
# Swap current pane with last pane
bind C-o select-pane -l \; swap-pane -s '!'
bind-key -r i run-shell "tmux neww ~/.local/bin/tmux-cht.sh"
# keybindings to make resizing easier
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
# reload config
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# Popup session selector
bind C-j display-popup -E "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
# Clear scrollback history - similar to zsh binding C-M-l to clear visibile history
bind -n C-M-k clear-history
# Status bar / window
set -g status on
set -g status-justify "left"
set -g status-left-length 15
set -g status-right-length 150
set -g window-status-separator ""
# Reset styles
set -g status-left-style NONE
set -g status-right-style NONE
# Split creation
bind '|' split-window -h -c "#{pane_current_path}"
bind '\' split-window -h -c "#{pane_current_path}"
bind '-' split-window -v -c "#{pane_current_path}"
bind '_' split-window -v -c "#{pane_current_path}"
# Reset pane sizes to current layout
bind '=' select-layout
# 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)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
# Shortcut for jumping into scroll-mode when not in vim. Also allow C-y for fzf
# to allow easy copying of commit hashes from forgit
bind-key -n 'C-y' if-shell "$is_vim || $is_fzf" 'send-keys C-y' 'copy-mode'
bind-key -n 'C-h' if-shell "$is_vim" \
'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' }
bind-key -n 'C-j' if-shell "$is_vim" \
'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' }
bind-key -n 'C-k' if-shell "$is_vim" \
'send-keys C-k' { if -F '#{pane_at_top}' '' 'select-pane -U' }
bind-key -n 'C-l' if-shell "$is_vim" \
'send-keys C-l' { if -F '#{pane_at_right}' '' 'select-pane -R' }
bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' '' 'select-pane -L'
bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D'
bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U'
bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R'
# Provide way to clear terminal (since Ctrl-l is taken)
bind -n C-M-l run "tmux send-keys C-l"
# Easier inline selection
bind -T copy-mode-vi 'v' send -X begin-selection
######################################
# tmux-plugins/tmux-prefix-highlight #
######################################
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
##########################
# yardnsm/tmux-1password #
##########################
# Filter for cli tags - without below, default filtering excludes anything without a url
set -g @1password-filter-tags 'cli'
#########################
# fcsonline/tmux-thumbs #
#########################
set -g @thumbs-key c-f
#{{- if eq "crostini" .ostype }}
set -g @thumbs-command 'echo -n {} | xsel --clipboard && tmux display-message "Copied {}"'
#{{- end }}
#{{- if eq "macOS" .ostype }}
set -g @thumbs-command 'echo -n {} | pbcopy && tmux display-message "Copied {}"'
#{{- end }}
set -g @thumbs-upcase-command 'tmux set-buffer {} && tmux paste-buffer'
##########################
# tmux-plugins/tmux-yank #
##########################
#{{- if eq "crostini" .ostype }}
set -g @override_copy_command 'xsel --clipboard'
#{{- end }}
set -g @shell_mode 'vi'
# tpm plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'jbnicolai/tmux-fpp'
set -g @plugin 'yardnsm/tmux-1password'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/vim-tmux-focus-events'
set -g @plugin 'fcsonline/tmux-thumbs'
# Install tpm if not installed
if "test ! -d ~/.tmux/plugins/tpm" {
display-message -d 0 'Installing tpm...'
run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'
display-message -d 0 'Installing tpm plugins...'
run '~/.tmux/plugins/tpm/bin/install_plugins'
}
run '~/.tmux/plugins/tpm/tpm'