-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
79 lines (71 loc) · 3.14 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
# === Resources ===
# - https://github.com/tmux/tmux/wiki
# - https://docs.joshuatz.com/cheatsheets/bash-and-shell/#tmux (I should really split this up
# into a sub-page at some point...)
# =================
# === Pass though ====
set -g update-environment \
"DISPLAY \
SSH_ASKPASS \
SSH_AUTH_SOCK \
SSH_AGENT_PID \
SSH_CONNECTION \
WINDOWID \
XAUTHORITY \
WEZTERM_CONFIG_DIR \
WEZTERM_CONFIG_FILE \
WEZTERM_EXECUTABLE \
WEZTERM_EXECUTABLE_DIR \
WEZTERM_PANE \
WEZTERM_UNIX_SOCKET \
JTZ_SESSION_NAME \
"
set -g allow-passthrough on
# === /Pass though ===
# Default left length is 10, which is way too small and clips the session name
set -g status-left-length 20
# Mouse and clipboard settings
set -g mouse on
# Copy to clipboard on mouse drag end - taken from https://unix.stackexchange.com/a/318285/428258
# Note: Using my own dotfiles wrapper - `copy_to_clipboard_if_not_empty` to handle two special cases:
# A) Cross-platform support, or even cross-windowing system support (e.g. `pbcopy` vs `xclip` vs `wl-copy`)
# B) when switching panes, or from a different app to terminal, it is easy
# to accidentally trigger this without actually having a selection; e.g., the click to switch apps triggers this
# but I was just switching apps, not making a text selection, so the buffer is empty and my clipboard suddenly
# gets overwritten to an empty value :(
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "copy_to_clipboard_if_not_empty"
# With mouse mode on, scrolling through traditional pager programs does not
# work in tmux, whereas it works just fine in a terminal used directly.
# This works around this limitation to map the mouse events to keyboard events
# https://github.com/tmux/tmux/issues/1320#issuecomment-381952082
tmux_commands_with_legacy_scroll="nano less man"
bind-key -T root WheelUpPane \
if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Up Up Up" "copy-mode -et="'
bind-key -T root WheelDownPane \
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Down Down Down" "send -Mt="'
# === Styling ===
# Set active pane vs non-active pane styling
set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=black'
# === /Styling ===
# Argh - I want my esc key to work quickly
# Don't set to zero - causes quirky behavior (like random characters appearing
# every time I enter a tmux session)
set -s escape-time 20
# === Scroll Speed Settings ===
# -N1 = 1 line per scroll, -N2 = 2 lines per scroll, etc.
bind -T copy-mode WheelUpPane send -N2 -X scroll-up
bind -T copy-mode WheelDownPane send -N2 -X scroll-down
# VI mode
# bind-key -T copy-mode-vi WheelUpPane send -N1 -X scroll-up
# bind-key -T copy-mode-vi WheelDownPane send -N1 -X scroll-down
# == /Scroll Speed Settings ===
# == Scrollback buffer ==
set -g history-limit 5000
# == /Scrollback buffer ==