-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
200 lines (155 loc) · 5.46 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#set-option -g default-command "tmux-shell-wrapper"
set -g prefix C-a
bind C-a send-prefix
set -g history-limit 99999
# example: /usr/share/doc/tmux/examples/
# {{{ screen-keys.conf
# $Id: screen-keys.conf,v 1.7 2010/07/31 11:39:13 nicm Exp $
#
# By Nicholas Marriott. Public domain.
#
# This configuration file binds many of the common GNU screen key bindings to
# appropriate tmux key bindings. Note that for some key bindings there is no
# tmux analogue and also that this set omits binding some commands available in
# tmux but not in screen.
#
# Note this is only a selection of key bindings and they are in addition to the
# normal tmux key bindings. This is intended as an example not as to be used
# as-is.
# Bind appropriate commands similar to screen.
# screen ^C c
bind c new-window
# detach ^D d
bind d detach
# title A
unbind A
bind A command-prompt "rename-window %%"
# prev ^H ^P p ^?
unbind p
bind p previous-window
unbind BSpace
bind BSpace previous-window
# windows ^W w
unbind w
bind w list-windows
# quit \
unbind \
bind \ confirm-before "kill-server"
# kill K k
unbind k
bind k confirm-before "kill-window"
# redisplay ^L l
unbind l
bind l refresh-client
# split -v |
unbind |
bind | split-window
# :kB: focus up
unbind Tab
bind Tab select-pane -t:.+
unbind BTab
bind BTab select-pane -t:.-
# }}}
# {{{ vim-keys.conf
# $Id: vim-keys.conf,v 1.2 2010/09/18 09:36:15 nicm Exp $
#
# vim-keys.conf, v1.2 2010/09/12
#
# By Daniel Thau. Public domain.
#
# This configuration file binds many vi- and vim-like bindings to the
# appropriate tmux key bindings. Note that for many key bindings there is no
# tmux analogue. This is intended for tmux 1.3, which handles pane selection
# differently from the previous versions
unbind x
bind x "kill-pane"
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
#bind s split-window -v
#bind v split-window -h
# move around panes with hjkl, as one would in vim after pressing ctrl-w
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Disable key repeat when switching panes
# ref: https://stackoverflow.com/questions/13668633/split-pane-switching-in-tmux-switch-once-per-command
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R
# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind < resize-pane -L 1
bind > resize-pane -R 1
bind "(" resize-pane -D 1
bind ")" resize-pane -U 1
# Make shift+arrows, ctrl+arrows etc work in Vim.
#set -g xterm-keys on
# See if this fixes slow ESC issues.
# http://unix.stackexchange.com/questions/23138/esc-key-causes-a-small-delay-in-terminal-due-to-its-alt-behavior
set -s escape-time 0
# Start window and pane indices at 1.
#set -g base-index 1
#set -g pane-base-index 1
# Status bar styling and content.
set -g status-bg black
set -g status-fg white
set -g status-left '#S '
# Show keyboard layout in prompt, assuming some script writes it to that path;
# it's "/User/…" instead of "~" so VMs can read from their symlinked OS X host home directory.
#set -g status-right '#(cat /Users/$USER/.keyboard_layout 2> /dev/null) | #22T | %H:%M %d-%b-%y'
set -g status-right-length 60
set -g status-interval 2
# Highlight the active window in the status bar.
#set-window-option -g window-status-current-bg yellow
#set-window-option -g window-status-current-fg black
set-window-option -g window-status-current-style bg=yellow,fg=black
# Don't prompt to kill panes/windows.
#bind-key x kill-pane
bind-key & kill-window
# Cycle panes.
bind b select-pane -t :.+
bind C-b select-pane -t :.+
# More intuitive split-window mappings.
bind "'" split-window -h
bind - split-window -v
# Maximize pane, e.g. for copying.
bind-key z resize-pane -Z
# Switch pane and zoom
# https://twitter.com/tskogberg/status/792025881573199872
bind C-z select-pane -t :.+ \; resize-pane -Z
# Reload tmux conf.
unbind r
bind r source-file ~/.tmux.conf\; display "Reloaded conf."
# http://robots.thoughtbot.com/tmux-copy-paste-on-os-x-a-better-future
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Unbork my iTerm ctrl+1 etc mappings in tmux 2.1
# https://github.com/tmux/tmux/issues/159
set -g assume-paste-time 0
## set the default TERM
set -g default-terminal "tmux-256color"
## update the TERM variable of terminal emulator when creating a new session or attaching a existing session
set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TERM'
## determine if we should enable 256-colour support
if "[[ ${TERM} =~ 256color || ${TERM} == fbterm ]]" 'set -g default-terminal screen-256color'
# https://wiki.archlinux.org/index.php/Tmux#Terminal_emulator_window_titles
set -g set-titles on
set -g set-titles-string "#T"
# Powerline
set-option -g status on
set-option -g status-interval 2
set-option -g status-justify "left"
set-option -g status-left-length 10
set-option -g status-right-length 90
#set-option -g status-left "#(~/Dotfiles/tmux/tmux-powerline/powerline.sh left)"
#set-option -g status-right "#(~/Dotfiles/tmux/tmux-powerline/powerline.sh right)"
# tmux-resurrect
run-shell ~/Dotfiles/tmux/tmux-resurrect/resurrect.tmux
set -g @resurrect-capture-pane-contents 'on'
# tmux-yank
run-shell ~/Dotfiles/tmux/tmux-yank/yank.tmux
# macOS specific, source: https://github.com/chocoby/dotfiles/blob/master/.tmux.conf
if-shell 'test "$(uname)" = "Darwin"' 'source ~/Dotfiles/tmux.conf.macos'