-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_tmux.conf
140 lines (107 loc) · 4.85 KB
/
dot_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
# set prefix to backtick (`)
unbind C-b
set -g prefix `
# Allow switching prefix on the fly
bind ` set -g prefix ` \; bind ` send-prefix
bind ' ' set -g prefix C-Space \; bind ' ' send-prefix
# Bindings:
# - to see current bindings:
# list-keys -t {vi,emacs}-{edit,choice,copy}
# start with 1 on the left side instead of 0 on the right
set -g base-index 1
set -g pane-base-index 1
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded tmux configuration!"
# Reduce the command delay time to something a bit shorter
set -s escape-time 0
# Extend the repeat interval for repeatable commands (e.g., resize-pane)
set -sg repeat-time 1000
# 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}'
# 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-"
# Swap windows
bind-key '<' swap-window -d -t '{previous}' # Move window left.
bind-key '>' swap-window -d -t '{next}' # Move window right.
# vim like pane navigation
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resizing panes
# `-r` here means I can repeat without having to press prefix every time
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r H resize-pane -L 5
bind-key -r L resize-pane -R 5
# selecting windows
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# Automatically renumber window numbers on closing a pane
set -g renumber-windows on
# a bit more space
set-option -w -g main-pane-width 85
# Mouse
set -g mouse on
# 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
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
# Stay in copy mode on drag end, but otherwise exit for mouse up.
unbind-key -T copy-mode-vi MouseDragEnd1Pane
# bind-key -t vi-copy MouseUp1Pane cancel
# Use vi-style navigation in Copy mode (which is also scrollback mode)
set -g status-keys vi
setw -g mode-keys vi
# lots of history
set -g history-limit 100000
# quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
# rename windows better
bind , command-prompt "rename-window '%%'"
# Dynamically update iTerm tab and window titles.
set -g set-titles on
set -g focus-events on
# But don't change tmux's own window titles.
set -w -g automatic-rename off
# Fix was found https://unix.stackexchange.com/a/734894
set -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"
# Show bells in window titles.
set -g window-status-bell-style fg=yellow,bold,underscore
# Status bar.
set -g status-left-length 52
set -g status-right-length 451
set -g status-fg white
set -g status-bg colour234
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S '
set -g status-right "#[fg=yellow]$USER@#h #[fg=magenta]%l:%M %p"
set -g status-interval 60 # Default is 15.
set -g window-status-format "#[fg=white,bg=colour234] #I #W "
set -g window-status-current-format "#[fg=colour234,bg=colour39]#[fg=colour25,bg=colour39,noreverse,bold] #I #W #[fg=colour39,bg=colour234,nobold]"
# 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
# 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 ~/.tmux-local.conf