-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
154 lines (120 loc) · 5.38 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
# Set prefix to space.
unbind C-b
set -g prefix C-Space
# Bindings:
# - to see current bindings:
# tmux list-keys
# Open new/split panes with the path of the current pane.
unbind c
bind c new-window -c '#{pane_current_path}'
unbind %
bind % split-window -h -c '#{pane_current_path}'
unbind '"'
bind '"' split-window -v -c '#{pane_current_path}'
# Vim-like key bindings for pane navigation (default uses cursor keys).
unbind h
bind h select-pane -L
unbind j
bind j select-pane -D
unbind k
bind k select-pane -U
unbind l # normally used for last-window
bind l select-pane -R
# Resizing (mouse also works).
unbind Left
bind -r Left resize-pane -L 5
unbind Right
bind -r Right resize-pane -R 5
unbind Down
bind -r Down resize-pane -D 5
unbind Up
bind -r Up resize-pane -U 5
# Fast toggle between current and last-used window (normally prefix-l).
bind ^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 p select-layout -o
# Intuitive window-splitting keys.
bind | split-window -h -c '#{pane_current_path}' # normally prefix-%
bind \ split-window -h -c '#{pane_current_path}' # normally prefix-%
bind - split-window -v -c '#{pane_current_path}' # normally prefix-"
# Status bar.
set -g status-style 'bg=#373b41,fg=white,bold,italics'
set -g status-left-length 40
set -g status-left '#[fg=yellow,bold,italics]#S § ' # SECTION SIGN (UTF-8: c2 a7)
set -g status-right "#[fg=yellow,bold,italics]$USER@#h #[fg=magenta]%l:%M %p"
set -g status-interval 60 # Default is 15.
# Automatically renumber window numbers on closing a pane (tmux >= 1.7).
set -g renumber-windows on
# Highlight active window.
set -w -g window-status-current-bg red
# 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 -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"
# 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 -w -g main-pane-width 85
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ',xterm-256color:Tc'
set -g history-limit 4096
# Start window and pane numbering at 1, (0 is too hard to reach).
set -g base-index 1
set -g pane-base-index 1
# Don't wait for an escape sequence after seeing C-a.
set -s escape-time 0
# Dynamically update iTerm tab and window titles.
set -g set-titles on
# Needed as on tmux 1.9 and up (defaults to off).
# Added in tmux commit c7a121cfc0137c907b7bfb.
set -g focus-events on
# But don't change tmux's own window titles.
set -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 -w -g wrap-search off
# #T = standard window title (last command, see ~/.bash_profile)
# #h = short hostname
# #S = session name
# #W = tmux window name
#
# (Would love to include #(pwd) here as well, but that would only print the
# current working directory relative to the session -- ie. always the starting
# cwd -- which is not very interesting).
set -g set-titles-string "#T : #h > #S > #W"
# Show bells in window titles.
set -g window-status-bell-style fg=yellow,bold,underscore
# Turn off distracting border highlight: the background highlighting is probably
# enough. Default value of 8 comes from "pane-border-fg" in tmux's
# options-table.c.
set -g pane-active-border-fg 8
# 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 - | nc -U ~/.clipper.sock"
# "copy-pipe" requires tmux >= 1.8
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "nc -U ~/.clipper.sock"
# Search back to last prompt (mnemonic: "[b]ack"); searches for non-breaking
# space in prompt.
bind-key b copy-mode\; send-keys -X start-of-line\; send-keys -X search-backward " "
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 ~/.tmux-local.conf