-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
170 lines (140 loc) · 6.45 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
unbind C-b # remove bind for C-b
set-option -g prefix C-s
bind-key C-s send-prefix
set -g default-terminal "tmux-256color"
set-option -sa terminal-overrides ",xterm*:Tc"
set-option -g set-titles on
set-option -g set-titles-string "#T"
# true colors and underline/undercurl support
set -as terminal-features ",xterm*:RGB"
set -as terminal-features 'xterm*:usstyle'
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-option -g mouse on
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
# Update default binding of `Enter` to also use copy-pipe
bind-key -Tcopy-mode-vi 'y' send -X copy-selection
bind r source-file ~/.tmux.conf; display "Reloaded!"
bind-key -n -N 'Toggle popup window' 'M-\' if-shell -F '#{==:#{session_name},popup}' {
detach-client
} {
display-popup -d "#{pane_current_path}" -xC -yC -w 80% -h 75% -E 'tmux attach-session -t popup || tmux new-session -s popup'
}
# toggle last session
bind-key -n M-s switch-client -l
# navigate windows
bind-key -n M-l next-window
bind-key -n M-h previous-window
# toggle last pane; but minimize pane unless it's the first/"main" pane
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
bind-key -n 'M-o' if-shell "$is_vim" {
last-pane
} {
select-pane -t 1
resize-pane -Z
}
bind | split-window -h
bind - split-window -v
bind-key b set-option status
# resize panes
bind-key -n 'S-M-Up' resize-pane -U 5
bind-key -n 'S-M-Down' resize-pane -D 5
bind-key -n 'S-M-Left' resize-pane -L 5
bind-key -n 'S-M-Right' resize-pane -R 5
# switch tmux sessions
bind-key -n 'M-a' display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
sed '/^$/d' |\
fzf --reverse --info hidden --header 'Jump to Tmux Session' --preview 'tmux capture-pane -pt {}' \
--preview-window 'down:50%' \
--bind 'enter:execute(tmux switch-client -t {})+accept'"
# fuzzy find directories to create new sessions
bind -n 'M-p' display-popup -b "rounded" -E "ta ~/code"
bind -n 'M-c' display-popup -b "rounded" -h 75% -w 65% -E "gh pr create"
bind -n 'M-w' display-popup -b "rounded" -h 75% -w 90% -E "gh pr checks --watch"
bind -n 'M-u' display-popup -b "rounded" -h 75% -w 65% -E "GH_FORCE_TTY=100% gh pr list | fzf --ansi --layout reverse --preview \'GH_FORCE_TTY=100% gh pr view {1}\' --preview-window down --header-lines 4 --bind 'ctrl-b:execute(gh pr view --web {1})' | awk \'{print $1}\' | xargs gh pr checkout"
# Renumber panes
set -g base-index 1
setw -g pane-base-index 1
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'soyuka/tmux-current-pane-hostname'
set -g status-interval 1
# status bar on top
set-option -g status-position bottom
# kanagawa
# set -g status-style fg='#cdd6f4',bg='default'
# set -g pane-border-style fg='#313244'
# set -g pane-active-border-style fg='#313244'
# are we zoomed into a pane?
# set -g status-left '#[bg=default]#[fg=#98BB6C] #S #{?window_zoomed_flag,↕ , }#[fg=#727169,bg=default] #(cd #{pane_current_path}; (git rev-parse --abbrev-ref HEAD; and echo "none") )'
# set-window-option -g window-status-style fg='#727169',bg=default
# set-window-option -g window-status-current-style fg='#E6C384',bg=default
# set -g window-status-current-format "#I #W"
# set -g window-status-format "#I #W"
# set -g window-status-separator ' '
#
# set -g message-style bg='#313244',fg='#fab387'
# set -g copy-mode-match-style bg='#313244',fg='#fab387'
# set -g copy-mode-mark-style bg='#313244',fg='#fab387'
# set -g copy-mode-current-match-style bg='#313244',fg='#f9e2af',bold
# set -g mode-style bg='#313244',fg='#a6e3a1',bold
# set -g popup-style bg=default
# set -g popup-border-style bg=default,fg='#313244'
# end kanagawa
# vscode
set -g status-style fg='#cdd6f4',bg='default'
set -g pane-border-style fg='#313131'
set -g pane-active-border-style fg='#313131'
# are we zoomed into a pane?
set -g status-left ' #[bg=default]#[fg=#e2c08d] #S #{?window_zoomed_flag, , } #[fg=#8c8c8c,bg=default] #(cd #{pane_current_path}; (git rev-parse --abbrev-ref HEAD; and echo "none") )'
set -g status-left-length 75
set-window-option -g window-status-style fg='#8c8c8c',bg=default
set-window-option -g window-status-current-style fg='#e2c08d',bg=default
set -g window-status-current-format " #W"
set -g window-status-format " #W"
set -g window-status-separator ' '
set -g message-style bg='#252526',fg='#d4d4d4'
set -g copy-mode-match-style bg='#313244',fg='#fab387'
set -g copy-mode-mark-style bg='#313244',fg='#fab387'
set -g copy-mode-current-match-style bg='#313244',fg='#f9e2af',bold
set -g mode-style bg='#313244',fg='#a6e3a1',bold
set -g popup-style bg=default
set -g popup-border-style bg=default,fg='#313131'
set -g window-status-activity-style bg=default,fg='#d4d4d4'
# end vscode
set -g status-right '#{?#{==:#H,laptop},#[fg=#8c8c8c],#[fg=#C34043]} #U@#H '
set -g status-right-length 75
set -g status-justify absolute-centre
## mocha catppuccin
# set -g status-style fg='#cdd6f4',bg='default'
# set -g pane-border-style fg='#313244'
# set -g pane-active-border-style fg='#313244'
#
# # are we zoomed into a pane?
# set -g status-left '#[bg=default]#[fg=#fab387] #S #{?window_zoomed_flag,↕ , }#[fg=#cdd6f4,bg=default] #{pane_current_command} '
# set-window-option -g window-status-style fg='#cdd6f4',bg=default
# set-window-option -g window-status-current-style fg='#f2cdcd',bg=default
# set -g window-status-current-format " #I #W"
# set -g window-status-format "#I #W"
# set -g window-status-separator ' '
#
# set -g message-style bg='#313244',fg='#fab387'
# set -g copy-mode-match-style bg='#313244',fg='#fab387'
# set -g copy-mode-mark-style bg='#313244',fg='#fab387'
# set -g copy-mode-current-match-style bg='#313244',fg='#f9e2af',bold
# set -g mode-style bg='#313244',fg='#a6e3a1',bold
# set -g popup-style bg=default
# set -g popup-border-style bg=default,fg='#313244'
#
# set -g status-right ' '
# set -g status-left-length 50
# set -g status-justify right
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'