-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy path.tmux.conf
executable file
·144 lines (118 loc) · 4.79 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
# Don't lose ENV
set -ga update-environment ' ITERM_PROFILE TMUX_STATUS_LEFT'
set-window-option -g mode-keys vi
set -g default-terminal "tmux-256color"
set -g default-shell $SHELL
## keybindings
unbind C-b
unbind C-a
unbind ,
unbind .
unbind n
unbind p
unbind [
unbind '"'
unbind l
unbind &
unbind "'"
set-option -g prefix C-a # C-a for prefix just like screen
bind-key C-a last-window
bind-key + resize-pane -Z
bind-key = resize-pane -Z
bind-key | split-window -h
bind-key \ split-window -h
bind-key - split-window -v
# windows and panes
bind-key S command-prompt -p ssh: "new-window -n %1 'ssh %1'"
bind-key u select-window -t :1
bind-key W split-window -h \; choose-window 'kill-pane ; join-pane -hs %%'
bind-key x kill-pane
bind-key X kill-window
bind-key q confirm-before kill-session
bind-key Q confirm-before kill-server
bind-key , previous-window # <
bind-key . next-window # >
bind-key < swap-window -t :-
bind-key > swap-window -t :+
bind-key BSpace switch-client -l
# vi mode
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-selection
# Smart pane switching with awareness of Vim splits
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
# Bring back clear screen under tmux prefix
bind C-l send-keys 'C-l'
# Bring back kill line under tmux prefix
bind C-k send-keys 'C-k'
bind-key n command-prompt 'rename-window "%%"'
bind-key N command-prompt 'rename-session "%%"'
bind-key Escape copy-mode -u
bind-key Up copy-mode -u
bind-key r source-file $HOME/.tmux.conf\; display "The matrix has been reloaded"
bind-key R refresh-client
bind-key a send-key C-a
# -r: can be repeated without pressing prefix# again (500ms after last '-r' action or prefix)
bind-key -r h select-pane -t :.-
bind-key -r l select-pane -t :.+
set -g history-limit 10000
## messages
set-option -g message-style fg=colour0,bg=colour4
set-option -g display-time 5000
## set status bar
set-option -g status-interval 10
set-option -g status-style fg=colour08,bg=colour0
set-option -g status-left-style fg=colour0,bg=colour8
set-option -g status-right-style bg=colour0
bind-key / set-option status
# "I' == current window index
# 'H' == Hostname
# 'F' == current window flag
# 'P' == current pane index
# 'S' == Session name
# 'T' == current window title
# 'W' == current window name
# '#' == a literal "#"
# Where appropriate, special character sequences may be prefixed with a
# number to specify the maximum length, in this line "#10W'.
set -g status-left ""
set-option -g status-right '#(hostname) #[fg=colour3]#S#[fg=default] [#I:#P] /// #(battery -o tmux -m default -g default)#[fg=default]#(TZ="America/Chicago" date +"%%a %%d %%b %%H:%%M %%z" )'
set-option -g status-right-length 100
set-option -g status-left-length 120
set-window-option -g window-status-format ' #I:#W '
set-window-option -g window-status-style default
## highlight active window
set-window-option -g window-status-current-style fg=colour4,bg=default,bold
set-window-option -g window-status-current-format '[ #I:#W ]'
set-window-option -g window-status-bell-style fg=colour21,bg=colour9,blink
# renumber windows
set-option -g renumber-windows on
# starts windows at 1 not 0
set-option -g base-index 1
set-option -g visual-activity off
set-option -g set-titles on
set-option -gw automatic-rename on
set-option -gw monitor-activity off
## pane border and colors
set-option -g pane-active-border-style fg=colour4,bg=default
## chooser colors
set-window-option -g mode-style fg=black,bg=colour04
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
# vim: set ft=tmux: