-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtmux.conf
140 lines (105 loc) · 5.07 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
set -g update-environment 'DISPLAY GH_ENTERPRISE_TOKEN GH_HOST LINEAR_TOKEN SSH_AUTH_SOCK'
# Do this early so that it doesn't clobber any settings in this file
set -g @plugin 'tmux-plugins/tmux-sensible'
# Change session order back to alphabetical
# https://stackoverflow.com/a/63854302/406224
bind s choose-tree -sZ -O name
# ctrl-a beats ctrl-b
unbind C-b
set -g prefix C-a
# window split commands i can actually remember
unbind %
bind-key | split-window -h -c "#{pane_current_path}"
bind-key '\' split-window -h -c "#{pane_current_path}"
bind-key _ split-window -v -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
# Highlight active window
set-window-option -g window-status-current-style bg=blue
# Undercurl
# https://github.com/folke/tokyonight.nvim?tab=readme-ov-file#fix-undercurls-in-tmux
set -g default-terminal "${TERM}"
# prevent neovim from defaulting to brown background inside tmux
set -ag 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
if-shell "[ -f ~/.local/share/nvim/lazy/tokyonight.nvim/extras/tmux/tokyonight_moon.tmux ]" "source-file ~/.local/share/nvim/lazy/tokyonight.nvim/extras/tmux/tokyonight_moon.tmux"
# Override the "bold" in tokyonight_moon status-left
set -g status-left "#[fg=#1b1d2b,bg=#82aaff] #S #[fg=#82aaff,bg=#1e2030,nobold,nounderscore,noitalics]"
# Via :checkhealth nvim
# WARNING `focus-events` is not enabled. |'autoread'| may not work.
# - ADVICE:
# - (tmux 1.9+ only) Set `focus-events` in ~/.tmux.conf:
set-option -g focus-events on
# reload config
bind r source-file ~/.tmux.conf \; display-message -d 3000 '🍭 Config reloaded!'
bind h select-layout even-horizontal
bind v select-layout even-vertical
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
set -g history-limit 100000
# Set status bar
set -g status-position bottom
set -g status-interval 300
# use Ctrl-n to swap panes
# use arrow keys to cycle panes
bind-key C-n swap-pane -s :+.top \; rotate-window -Ut :+
# https://waylonwalker.com/tmux-killing-tmux/
bind k display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
fzf --reverse -m --header=kill-session |\
xargs -I {} tmux kill-session -t {}"
set-option -g status-left-length 80
set-option -g status-right-length 40
setw -g monitor-activity off
set -g visual-activity off
# set inactive/active window styles
set -g window-style 'fg=default,bg=default'
set -g window-active-style 'fg=colour250,bg=default'
# Try something like this if you want the active pane to be more obvious
#set -g window-active-style 'fg=colour250,bg=black'
# set the pane border colors
set -g pane-border-style fg=colour250,bg=colour236
set -g pane-active-border-style fg=blue,bg=colour250
# set previously-active window title colors
set-option -g window-status-last-style fg=colour50
# use a later bash
set-option -g default-command '/usr/bin/env bash -i'
# Maybe reduce lag
# https://github.com/tmux/tmux/issues/353#issuecomment-294570322
set-option -s escape-time 10
# Enable using the mouse to resize panes
# https://superuser.com/a/1017275/120685
#
# Toggle mouse rather than automatically turning it on. We do this to avoid
# constantly having to shift-click just to copy text.
# https://stackoverflow.com/a/65153140/406224
# Key bindings: ctrl-a ctrl-m
bind-key a set-option -g mouse \; display-message '🐭 Mouse #{?mouse,on,off}'
bind-key c-P display-popup -E "tmux new-session -A -s scratch"
bind-key ` display-popup -E tm
set-option -g status-right "#{?mouse,🐭,} #h | 💾 #{continuum_status}s"
# required for folke/zen-mode.nvim
set-option -g allow-passthrough on
# tmux-continuum needs to be the last plugin in this list
# See https://github.com/tmux-plugins/tmux-continuum#known-issues
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'alexwforsythe/tmux-which-key' # prefix + space
set -g @plugin 'tmux-plugins/tmux-continuum'
TMUX_FZF_LAUNCH_KEY="f"
TMUX_FZF_MENU="switch session\n/$HOME/.tmux/plugins/tmux-fzf/scripts/session.sh switch\n"
set -g @continuum-restore 'on'
set -g @continuum-save-interval '3600' # time is measured in seconds
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-dir '~/.cache/tmux/resurrect'
# https://github.com/tmux-plugins/tpm/blob/master/docs/automatic_tpm_installation.md#automatic-tpm-installation
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'