-
Notifications
You must be signed in to change notification settings - Fork 104
/
tmux.conf
166 lines (126 loc) · 6.22 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
# Set prefix to space.
unbind-key C-b
set-option -g prefix C-Space
# Bindings:
# - to see current bindings:
# tmux list-keys
# Open new/split panes with the path of the current pane.
unbind-key c
bind-key c new-window -c '#{pane_current_path}'
unbind-key %
bind-key % split-window -h -c '#{pane_current_path}'
unbind-key '"'
bind-key '"' split-window -v -c '#{pane_current_path}'
# Vim-like key bindings for pane navigation (default uses cursor keys).
unbind-key h
bind-key h select-pane -L
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key l # normally used for last-window
bind-key l select-pane -R
# Resizing (mouse also works).
unbind-key Left
bind-key -r Left resize-pane -L 5
unbind-key Right
bind-key -r Right resize-pane -R 5
unbind-key Down
bind-key -r Down resize-pane -D 5
unbind-key Up
bind-key -r Up resize-pane -U 5
# Fast toggle between current and last-used window (normally prefix-l).
bind-key ^space last-window
# `^space ^space` is awfully close to the destructive `^space space`, which
# trashes the layout. Providea quick way to get back to the previous-used
# layout.
#
# Normally used for previous-window, but I never use that, prefering numeric
# access.
bind-key p select-layout -o
# Intuitive window-splitting keys.
bind-key | split-window -h -c '#{pane_current_path}' # normally prefix-%
bind-key '\' split-window -h -c '#{pane_current_path}' # normally prefix-%
bind-key - split-window -v -c '#{pane_current_path}' # normally prefix-"
bind-key -r '<' swap-window -d -t '{previous}' # Move window left.
bind-key -r '>' swap-window -d -t '{next}' # Move window right.
# Status bar.
set-option -g status-style 'bg=#373b41,fg=white,bold,italics'
set-option -g status-left-length 40
set-option -g status-left '#[fg=yellow,bold,italics]#S § ' # SECTION SIGN (UTF-8: c2 a7)
set-option -g status-right "#[fg=yellow,bold,italics]$USER@#h #[fg=magenta]%l:%M %p"
set-option -g status-interval 60 # Default is 15.
# Automatically renumber window numbers on closing a pane (tmux >= 1.7).
set-option -g renumber-windows on
# Highlight active window.
set-option -w -g window-status-current-style bg=red
# Make widths constant with or without flags.
set-option -w -g window-status-current-format ' #I:#W#F '
set-option -w -g window-status-format ' #I:#W#{?#{==:#F,}, ,#F }'
set-option -w -g xterm-keys on
# Mouse can be used to select panes, select windows (by clicking on the status
# bar), resize panes. For default bindings see `tmux list-keys`.
set-option -g mouse on
# Stay in copy mode on drag end.
# (Would use `bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X
# stop-selection` but it is a bit glitchy.)
unbind-key -T copy-mode-vi MouseDragEnd1Pane
# Scroll 3 lines at a time instead of default 5; don't extend dragged selections.
bind-key -T copy-mode-vi WheelUpPane select-pane\; send-keys -t'{mouse}' -X clear-selection\; send-keys -t'{mouse}' -X -N 3 scroll-up
bind-key -T copy-mode-vi WheelDownPane select-pane\; send-keys -t'{mouse}' -X clear-selection\; send-keys -t'{mouse}' -X -N 3 scroll-down
# Make double and triple click work outside of copy mode (already works inside it with default bindings).
bind-key -T root DoubleClick1Pane if-shell -Ft'{mouse}' '#{alternate_on}' "send-keys -M" "copy-mode -t'{mouse}'; send-keys -t'{mouse}' -X select-word"
bind-key -T root TripleClick1Pane if-shell -Ft'{mouse}' '#{alternate_on}' "send-keys -M" "copy-mode -t'{mouse}'; send-keys -t'{mouse}' -X select-line"
# Don't exit copy mode on double or triple click.
bind-key -T copy-mode-vi DoubleClick1Pane if-shell -Ft'{mouse}' '#{alternate_on}' "send-keys -M" "copy-mode -t'{mouse}'; send-keys -t'{mouse}' -X select-word"
bind-key -T copy-mode-vi TripleClick1Pane if-shell -Ft'{mouse}' '#{alternate_on}' "send-keys -M" "copy-mode -t'{mouse}'; send-keys -t'{mouse}' -X select-line"
# For those times when C-c and q are not enough.
bind-key -T copy-mode-vi Escape send-keys -X cancel
# Slightly more useful width in "main-vertical" layout; enough room for 3-digit
# line number gutter in Vim + 80 columns of text + 1 column breathing room
# (default looks to be about 79).
set-option -w -g main-pane-width 85
set-option -g default-terminal "tmux-256color"
set-option -ga terminal-overrides ',xterm-256color:Tc'
set-option -g history-limit 10000
# Start window and pane numbering at 1, (0 is too hard to reach).
set-option -g base-index 1
set-option -g pane-base-index 1
# Don't wait for an escape sequence after seeing C-Space.
set-option -s escape-time 0
# Dynamically update iTerm tab and window titles.
set-option -g set-titles on
# Needed as on tmux 1.9 and up (defaults to off).
# Added in tmux commit c7a121cfc0137c907b7bfb.
set-option -g focus-events on
# But don't change tmux's own window titles.
set-option -w -g automatic-rename off
# Don't wrap searches; it's super confusing given tmux's reverse-ordering of
# position info in copy mode.
set-option -w -g wrap-search off
# - #S = session name
# - #T = pane title (~/.zshrc sets this to the last/current command)
set-option -g set-titles-string "#S > #T"
# Show bells in window titles.
set-option -g window-status-bell-style fg=yellow,bold,underscore
# Turn off distracting border highlight.
set-option -ga pane-active-border-style bg=default,fg=default
# Add : to the default list (" -_@") of word separators.
set-option -ga word-separators :/
# Make base16-shell work by turning passthrough of escape sequences.
# (Needed on tmux 3.3 and later).
set-option -g allow-passthrough all
# Make sure we always start at 1, even when invoked from a .tmux wrapper script.
set-environment -g SHLVL 1
# Clipper.
bind-key y run-shell "tmux save-buffer - | clip"
# "copy-pipe" requires tmux >= 1.8
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "clip"
# Search back to last prompt (mnemonic: "[b]ack").
bind-key b copy-mode\; send-keys -X start-of-line\; send-keys -X search-backward "❯"\; send-keys -X next-word
bind-key -T copy-mode-vi / command-prompt -i -p "search down" "send -X search-forward-incremental \"%%%\""
bind-key -T copy-mode-vi ? command-prompt -i -p "search up" "send -X search-backward-incremental \"%%%\""
# Analagous with naked C-l which resets/clears the terminal.
bind-key C-l clear-history
source-file -q ~/.config/tmux/color.conf
source-file -q ~/.config/tmux/local.conf