-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
146 lines (114 loc) · 3.64 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
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
set-option -g default-command "reattach-to-user-namespace -l $SHELL -l"
# Keep your finger on ctrl, or don't
bind-key ^D detach-client
bind k send-keys "clear"\; send-keys "Enter"
# auto window rename
set-window-option -g automatic-rename
# Pane resize in all four directions using vi bindings.
# Can use these raw but I map them to shift-ctrl-<h,j,k,l> in iTerm.
bind-key J resize-pane -D 31
bind-key K resize-pane -U 30
bind-key H resize-pane -L 30
bind-key L resize-pane -R 30
# quick pane cycling
unbind ^S
bind ^S select-pane -t:.+
# switching between sessions
unbind ^A
bind ^A choose-tree
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# switch windows alt+number
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
# Use vi keybindings for tmux commandline input.
# Note that to get command mode you need to hit ESC twice...
set -g status-keys vi
# Use vi keybindings in copy and choice modes
setw -g mode-keys vi
#
# easily toggle synchronization (mnemonic: e is for echo)
# sends input to all panes in a given window.
bind e setw synchronize-panes on
bind E setw synchronize-panes off
# set first window and pane to index 1 (not 0) to map more to the keyboard layout...
set -g base-index 1
set -g pane-base-index 1
# play nice with system clipboard
set-option -g default-command "reattach-to-user-namespace -l zsh"
bind C-c run "tmux show-buffer | reattach-to-user-namespace pbcopy"
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
# vi style copy&paste
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# reload config
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix
# Activity monitoring
setw -g monitor-activity on
set -g visual-activity on
# Mouse mode
setw -g mode-mouse on
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
# Panes
# horizontal and vertical splits
unbind |
bind | split-window -h
unbind _
bind _ split-window
# tile all windows
unbind =
bind = select-layout tiled
unbind +
bind + resize-pane -Z
unbind Right
bind Right resize-pane -R 8
unbind Left
bind Left resize-pane -L 8
unbind Up
bind Up resize-pane -U 4
unbind Down
bind Down resize-pane -D 4
# Status line
source ~/.tmuxline
# Screen like binding
unbind C-b
set -g prefix C-a
# No escape time for vi mode
set -sg escape-time 0
# Screen like binding for last window
bind C-a last-window
# Bigger history
set -g history-limit 10000