-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathtmux.conf
More file actions
162 lines (120 loc) · 4.7 KB
/
tmux.conf
File metadata and controls
162 lines (120 loc) · 4.7 KB
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
# Originally copied from Daniel Nolan's dotfile repo, with heavy modifications
#
# References
#
# * http://man.openbsd.org/OpenBSD-current/man1/tmux.1
# GENERAL SETTINGS
# ----------------
# use shell set as SHELL env variable as default shell
set-option -g default-shell $SHELL
# default terminal is 256 color
set -g default-terminal "screen-256color"
# start window index at 1
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
# automatically renumber windows as they are created and destroyed
set-option -g renumber-windows on
# lower the delay between the prefix key and other keys (fixes pause when using vim)
set -sg escape-time 1
# use vi-like key bindings for the tmux command prompt
set -g status-keys vi
# use vi-like key bindings in copy mode
set-window-option -g mode-keys vi
# keep up to 8k lines of pane history
set -g history-limit 8000
# monitor window activity and generate notifications
set-window-option -g monitor-activity on
# show activity notifications on status line
set -g visual-activity on
# Constrain the window size to the size of the smallest client's window, if that
# client is looking at it
set-window-option -g aggressive-resize on
# KEY BINDINGS
# ------------
# unbind old prefix
unbind C-b
# remap prefix to Control + a
set -g prefix C-f
# prefix-r to force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# quick pane cycling
unbind ^F
bind ^F select-pane -t :.+
#new 25% vertical split pane
bind ^T split-window -p 25
# setup 'v' to being selection as in Vim
bind -T copy-mode-vi v send-keys -X begin-selection
# once in selection mode use Ctrl-v to switch to block selection mode
bind -T copy-mode-vi 'C-v' send -X rectangle-toggle
# begin selection in copy mode.
bind -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "pbcopy"
# allow copying with the mouse
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
# update default binding of `Enter` to also use copy-pipe
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
# select panes with <Prefix> h, j, k, l
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resize panes with <Prefix> H, J, K, L
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r H resize-pane -L 5
bind -r L resize-pane -R 5
# cycle windows with C-h and C-l
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Rebind pane splitting, set current directory to same directory as current pane
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# By default show sessions with windows (and panes) collapsed when listing sessions
bind 'w' choose-tree -Zs
# Smart pane switching with awareness of vim splits
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Turn mouse on with leader m
bind m \
set -g mouse on \;\
display 'Mouse: ON'
# Turn mouse off with leader M
bind M \
set -g mouse off \;\
display 'Mouse: OFF'
# APPEARANCE
# ----------
# Colors
# See https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
set-option -g status-style fg=colour8,bg=colour0,default
# Status line format and colors
set -g status-left-length 40
set -g status-left "#[fg=colour8]Session: #S"
set -g status-right "#[fg=colour8][%m/%d/%Y %l:%M%p]"
set -g status-justify centre # center window list
# default window title fg, bg, and attribute
set-window-option -g window-status-style fg=colour8,bg=default,default
# current window title color
set-window-option -g window-status-current-style fg=colour2,bg=default
# pane border styles
set-option -g pane-border-style fg=colour10,bg=default
set-option -g pane-active-border-style fg=colour29,bg=colour254
# show pane title above pane
set -g pane-border-status top
# make background of non-active panes darker
set -g window-style fg=default,bg=colour15
set -g window-active-style fg=default,bg=colour231
# change color of status line when using prompt
set-option -g message-style fg=colour15,bg=colour1
# colors for pane numbers when using the display-panes command
set -g display-panes-active-colour colour33
set -g display-panes-colour colour166
# Reverse colors of selected text in pane when in copy or search mode, a bit
# intense but very easy to see
set -g mode-style fg=colour6,bg=default,reverse