-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux.conf
More file actions
140 lines (107 loc) · 4.99 KB
/
Copy pathtmux.conf
File metadata and controls
140 lines (107 loc) · 4.99 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
# Change prefix
set -g prefix C-s
unbind C-b
bind C-s send-prefix
# Reload tmux config
unbind r
bind r source-file ~/.tmux.conf
# OPTIONS ######################################################################
# Use vim key bindings
set-window-option -g mode-keys vi
# Mouse mode
set -g mouse on
# Send focus events for vim
set -g focus-events on
# Enable hyperlinks
set -as terminal-features ",*:hyperlinks"
# Allow kitty keyboard protocol passthrough (e.g. ctrl+enter in copilot cli)
set -g allow-passthrough on
set -s extended-keys always
# extended-keys-format is a tmux 3.4+ option; guard it so older tmux
# (e.g. Debian 12's 3.3a in codespaces) doesn't error on startup.
if-shell -b '[ "$(printf "%s\n3.4" "$(tmux -V | sed "s/^tmux //")" | sort -V | head -n1)" = "3.4" ]' \
"set -s extended-keys-format csi-u"
set -as terminal-features 'xterm*:extkeys'
# Don't intercept shift+enter so apps receive the raw escape sequence
unbind -T root S-Enter
# Keep a lot of shell history
set-option -g history-limit 2000000
# Set the default terminal mode to 256color mode
set -g default-terminal "xterm-256color"
# Neovim asked for this
set-option -sg escape-time 10
# Show shell titles
set-option -g set-titles on
# Close gaps between closed windows
set -g renumber-windows on
# Persist the set of open windows (their dirs) whenever windows are opened or
# closed, so `wtr` can reopen the ones you last had open after a restart.
set-hook -g after-new-window 'run-shell -b "tmux-window-snapshot"'
set-hook -g window-unlinked 'run-shell -b "tmux-window-snapshot"'
# BINDINGS #####################################################################
# Refresh client
bind C-r refresh-client
# Cycle through windows
bind C-s last-window
bind -n C-Tab select-window -t :+
bind -n C-S-Tab select-window -t :-
# Search history
bind / copy-mode \; send-keys ?
# Scroll up into copy mode
bind C-b copy-mode -u
# Split panes
bind \\ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Join windows
bind J command-prompt -p "join pane from:" "join-pane -s '%%'"
bind s command-prompt -p "send pane to:" "join-pane -t '%%'"
# Copy paste
bind -T copy-mode-vi 'v' send-keys -X begin-selection
bind -T copy-mode-vi 'y' send-keys -X copy-pipe "xclip -selection c"
# Copy/paste over ssh from tmux, see: https://gist.github.com/burke/5960455
bind C-c run "tmux save-buffer - | pbcopy-remote"
bind -T copy-mode-vi 'C-c' send-keys -X copy-pipe "pbcopy-remote"
bind C-v run "tmux set-buffer $(pbpaste-remote); tmux paste-buffer"
bind C-o run "tmux save-buffer - | chropen"
# Copy the current pane's contents to the clipboard. Uses tmux's native
# set-clipboard (OSC 52) via load-buffer -w so it works on macOS and Linux
# (and over SSH) without needing pbcopy/xclip/wl-copy.
bind P run "tmux capture-pane -p | tmux load-buffer -w -"
# Copy locally
bind y run "tmux save-buffer - | xclip -selection c"
bind o run "tmux save-buffer - | chropen"
# Create a new window
bind Space new-window -c "#{pane_current_path}"
# for easier rolling without worrying about letting go of ctrl
bind C-Space new-window -c "#{pane_current_path}"
bind C-d detach-client
# to act like vim
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# to move windows
bind S-Left swap-window -t -1
bind S-Right swap-window -t +1
# DISPLAY ######################################################################
set -g status-justify centre
set -g status-style bg=default
set -g status-style fg=white
# Show the codespace name in the bottom left when running in a codespace.
set -g status-left-length 40
set -g status-left '#(tmux-codespace-name)'
set -g status-right '#(tmux-cpu-mem)'
set -g status-interval 5
set -g automatic-rename on
set -g automatic-rename-format '#{b:pane_current_path}'
# Show the running command's Nerd Font icon (or the branch's PR status when the
# pane is in a repo with a PR) via the tmux-window-icon helper.
set -g window-status-format '#[fg=white]#I #(tmux-window-icon #{pane_current_path} #{pane_current_command}) #[fg=white]#W#{?@copilot_busy, ,#{?#{==:#{pane_pb_state},normal}, #[fg=cyan] #{pane_pb_progress}%#[fg=white],#{?#{==:#{pane_pb_state},error}, #[fg=red]#[fg=white],#{?#{==:#{pane_pb_state},paused}, #[fg=yellow] #{pane_pb_progress}%#[fg=white],}}}}#{?window_bell_flag, #[fg=red],}#[default]'
set -g window-status-current-format '#[fg=cyan,bold]#I #(tmux-window-icon #{pane_current_path} #{pane_current_command}) #[fg=cyan,bold]#W#{?@copilot_busy, ,#{?#{==:#{pane_pb_state},normal}, #[fg=cyan] #{pane_pb_progress}%#[fg=cyan,bold],#{?#{==:#{pane_pb_state},error}, #[fg=red]#[fg=cyan,bold],#{?#{==:#{pane_pb_state},paused}, #[fg=yellow] #{pane_pb_progress}%#[fg=cyan,bold],}}}}#{?window_bell_flag, #[fg=red],}#[default]'
set -g window-status-current-style bold,fg=cyan
# Show a static bell glyph on windows with a pending bell (no blinking).
setw -g monitor-bell on
setw -g window-status-bell-style 'none'