-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
174 lines (133 loc) · 4.38 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
###########################
# Configuration
###########################
# increase scroll-back history
set -g history-limit 20000
# use vim key bindings
setw -g mode-keys vi
# mouse
setw -g mouse on
# decrease command delay (increases vim responsiveness)
set -sg escape-time 1
set -g escape-time 1
# increase repeat time for repeatable commands
set -g repeat-time 1000
# start window index at 1
if-shell -b '[[ -z $SPIN ]]' {
set -g base-index 1
setw -g pane-base-index 1
}
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
# re-number windows when one is closed
set -g renumber-windows on
# set $SHELL as default
set-option -g default-shell $SHELL
###########################
# Key Bindings
###########################
# tmux prefix
if-shell '[[ -z $SPIN ]]' {
unbind C-b
set -g prefix C-s
bind-key C-s send-prefix
}
# toggle mouse on
bind-key m \
set-option -g mouse on \;\
display-message 'Mouse: ON'
# toggle mouse off
bind-key M \
set-option -g mouse off \;\
display-message 'Mouse: OFF'
# last window
bind-key j last-window
# enter copy mode (aka visual mode)
unbind [
bind-key v copy-mode
# create 'v' alias for selecting text
bind-key -T copy-mode-vi v send-keys -X begin-selection
# window splitting
unbind %
bind | split-window -h -c '#{pane_current_path}'
unbind '"'
bind _ split-window -v -c '#{pane_current_path}'
# change default option, new window creates one in same path
bind-key c new-window -c "#{pane_current_path}"
# access build logs (and go back!)
bind-key o command-prompt -p "See logs for:" "run-shell -b '~/bin/get-build-logs %%'"
bind-key O switch-client -p
# resize panes
bind-key -r H resize-pane -L 20
bind-key -r J resize-pane -D 10
bind-key -r K resize-pane -U 10
bind-key -r L resize-pane -R 20
## Join windows: <prefix> s, <prefix> j
bind-key u command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"
# quickly switch panes
unbind ^J
bind ^J select-pane -t :.+
# select window with fzf
unbind w
bind-key w run-shell -b "$BIN/tmux-switch-window"
# select tabs around
bind-key -n C-Left select-window -p
bind-key -n C-Right select-window -n
# bind -n C-S-h select-window -p
# bind -n C-S-l select-window -n
# move tabs around
bind-key -r h swap-window -d -t -1;
bind-key -r c-h swap-window -d -t -1;
bind-key -r l swap-window -d -t +1;
bind-key -r c-l swap-window -d -t +1;
# quicly page up
unbind ^f
bind ^f copy-mode -u
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# natural pane navigation
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?|git|jira)(diff)?" || echo "#{pane_title}" | grep -qE "spin#"'
bind-key V display "#{pane_current_command} #{pane_current_path}"
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"
# Fast search
bind -n C-f copy-mode \; command-prompt -p "(search up)" "send -X search-backward \"%%%\""
###########################
# Status Bar
###########################
# enable UTF-8 support in status bar
# set -g status-utf8 on
# set refresh interval for status bar
set -g status-interval 30
# center the status bar
set -g status-justify left
# show session, window, pane in left status bar
set -g status-left-length 40
set -g status-left '#[fg=green]#S#[fg=blue] #I:#P#[default]'
# show hostname, date, time, and battery in right status bar
set-option -g status-right '#[fg=green]#H#[default] %m/%d/%y %I:%M\
#[fg=red]#(battery discharging)#[default]#(battery charging)'
###########################
# Colors
###########################
# color status bar
set -g status-bg colour235
set -g status-fg white
# highlight current window
set-window-option -g window-status-style fg=black,bg=green
# set color of active pane
set -g pane-border-style fg=colour235,bg=black
set -g pane-active-border-style fg=green
set-window-option -g clock-mode-colour colour64 #green
# tpm bs that should be in osx
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-open'
# open links with x instead of o
set -g @open 'x'
# Load os specific tmux configs
if-shell "uname | grep -q Darwin" "source-file ~/dotfiles/tmux-darwin" "source-file ~/dotfiles/tmux-linux"