-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.tmux.conf
175 lines (129 loc) · 4.91 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
###########################
# Configuration
###########################
# use 256 term for pretty colors
set -g default-terminal "screen-256color"
# increase scroll-back history
set -g history-limit 5000
# use vim key bindings
setw -g mode-keys vi
# enable mouse
set -g mouse on
# decrease command delay (increases vim responsiveness)
set -sg escape-time 1
# increase repeat time for repeatable commands
set -g repeat-time 1000
# start window index at 1
set -g base-index 1
# start pane index at 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-option -g default-command "reattach-to-user-namespace -l zsh"
###########################
# Key Bindings
###########################
# tmux prefix
set -g prefix C-^
unbind-key C-b
#unbind C-b
bind-key C-^ send-prefix
#Rearrange window tabs with ctrl+shift+left/right
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1
# copy with 'enter' or 'y' and send to mac os clipboard: http://goo.gl/2Bfn8
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# create 'v' alias for selecting text
bind-key -t vi-copy v begin-selection
# paste
unbind C-p
bind C-p paste-buffer
# window splitting
unbind %
bind v split-window -h -c '#{pane_current_path}'
unbind '"'
bind s split-window -v -c '#{pane_current_path}'
# quickly switch panes
unbind ^J
bind ^J select-pane -t :.+
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# 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
# 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 10
bind > resize-pane -R 10
bind - resize-pane -D 10
bind _ resize-pane -D 10
bind + resize-pane -U 10
bind = resize-pane -U 10
# smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}x#{pane_title}" | grep -iqE "(^vimx|xvim|vim|nvim$)"'
bind -n C-h if-shell "$is_vim" "send-keys C-q" "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-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"
#bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
#bind -n C-h if "[[ ($(tmux display -p '#{pane_current_command}') =~ ^(vim$|git$)) ]]" "send-keys C-h" "select-pane -L"
#if [[ 'sdf' =~ ^(sf$|sdf$) ]]; then echo 'works'; fi
# window selection
# cmd+1 0x1C 0x31 (ctrl-a 1)
# cmd+2 0x1C 0x32 (ctrl-a 2)
# cmd+3 0x1C 0x33 (ctrl-a 3)
###########################
# 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 -g status-right '#[fg=green]#(hostname | cut -d "." -f 1) #[fg=blue]%m/%d #[fg=white]%I:%M#[default] #{battery_icon}#(~/dotfiles/scripts/tmux-battery-info)'
#set-option -g status-right '#[fg=green] %m/%d/%y %I:%M #[fg=red]#(battery discharging)#[default]#(battery charging)'
#set-option -g status-right '#[fg=green] %m/%d %I:%M'
#set -g status-right '#[fg=green]#(hostname | cut -d "." -f 1) #[fg=blue]%m/%d #[fg=white]%I:%M#[default] #[fg=green]#{battery_percentage}#{battery_remain}#{battery_icon}'
###########################
# Colors
###########################
# color status bar
set -g status-bg colour235
set -g status-fg white
# highlight current window
set-window-option -g window-status-current-fg black
set-window-option -g window-status-current-bg green
# set color of active pane
set -g pane-border-fg colour235
set -g pane-border-bg black
set -g pane-active-border-fg green
set -g pane-active-border-bg black
# hex code key bindings in iterm work in new tmux
set -g assume-paste-time 0
###########################
# Plugins
###########################
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
#set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-battery'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'