-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.tmux.conf
188 lines (168 loc) · 7.08 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
# start window indexing at one instead of zero
set -g base-index 1
set -g pane-base-index 1
# Add truecolor support
set-option -ga terminal-overrides ",xterm-256color:Tc"
# Default terminal is 256 colors
set -g default-terminal "xterm-256color"
set-option -g default-command "/bin/zsh"
# set -g default-terminal "xterm-kitty"
# set this otherwise the text will become garbled # not needed from tmux 2.2 TODO remove
set -gq utf8 on
set -gq status-utf8 on
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
set -g history-limit 1000000
set -g mouse on
set -g renumber-windows on
set -g detach-on-destroy off
set -g focus-events on
# Tmux Appearance -------------------- {{{
set -g status-left " #S "
set -g status-left-length 13
set -g status-right-length 95
set -g message-style fg=white,bg=red,bright
# set -g status-left-style fg=white,bg=colour232 # old status theme1
set -g status-left-style fg=#eee8d5,bold,bg=#6700b5
set -g status-style fg=colour241,bg=colour233
# set -g window-status-current-style fg=colour33,bold,bg=colour8 # old status theme1
set -g window-status-current-style fg=#eee8d5,bold,bg=#b58900
set -g window-status-current-format "#{?window_last_flag,`, }#{?window_zoomed_flag,[,}#I:#W#{?window_zoomed_flag,],}#{?window_last_flag,`, }"
set -g window-status-format "#{?window_last_flag,`, }#{?window_zoomed_flag,[,}#I:#W#{?window_zoomed_flag,],}#{?window_last_flag,`, }"
set -g set-titles on
# #h hostshort , #S session , #W window , #T pane name
# time since widget
wg_tsnce="#(bash ~/src/private/bin/time_since_date_via_pushbullet.sh)" # Time since
# prefix indicator widget
wg_prfx=" #[fg=colour231,bg=default]#{?client_prefix,<Prefix>,}"
wg_pane=" #[fg=colour202,bg=default]#{=26:pane_title}"
wg_date=" #[fg=colour231,bold,italics,bg=default]%d-%b-%Y#[none]"
wg_time=" #[fg=colour220,bold,bg=default]%H:%M"
set -g status-right "${wg_tsnce}${wg_prfx}${wg_pane}${wg_date}${wg_time}"
# Set pane styles
set -g pane-border-style fg=colour8
set -g pane-active-border-style fg=magenta
# set -g pane-border-status top
set -g pane-border-format " #[fg=colour202,bold,bg=default]#T#[none] "
# }}}
setw -g aggressive-resize on
# Dissable automatically renaming pane titles.
# Samilar setting done in zshrc as well
setw -g allow-rename off
set-window-option -g automatic-rename off
#################################################################### key Bindings with PREFIX
# C-b is not acceptable as prefix -- Vim uses it
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set -g prefix2 C-Space
bind C-Space send-prefix -2
# use vim key bindings
setw -g mode-keys vi
# keep uniform across vim, urxvt and tmux
bind -T copy-mode-vi 'v' send -X begin-selection
bind -T copy-mode-vi 'C-v' send -X rectangle-toggle
# (t)itle: toggle pane labels
bind C-t run-shell 'tmux set -g pane-border-status'
# (n)ame: command to rename pane title on the fly (same as set_tmux_pane_title in ~/bin/function )
bind n command-prompt -I "#T" "select-pane -T '%%'"
# (S)tatus: toggle status line visibility
bind S set-option -g status
# (r)eload
bind r source-file ~/.tmux.conf \; display "Reloaded tmux config file."
# Removing backspace bind to avoid accidental kills
#
# bind Bspace "kill-session"
#
# (s)ync:
bind s set-window-option synchronize-panes \; display "sync toggle"
# Easy bindings for split
bind '\' split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# bind with no prefix commnds
# hjkl pane resize
bind -n M-C-h resize-pane -L 2
bind -n M-C-j resize-pane -D 2
bind -n M-C-k resize-pane -U 2
bind -n M-C-l resize-pane -R 2
# switch windows alt+number
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
# complensate for the lost keys to send actual 'key' do prefix + 'key' ( for tmux in tmux )
bind M-h send-keys 'M-h'
bind M-j send-keys 'M-j'
bind M-k send-keys 'M-k'
bind M-l send-keys 'M-l'
bind M-1 send-keys 'M-1'
bind M-2 send-keys 'M-2'
bind M-3 send-keys 'M-3'
bind M-4 send-keys 'M-4'
bind M-5 send-keys 'M-5'
bind M-6 send-keys 'M-6'
bind M-7 send-keys 'M-7'
bind M-8 send-keys 'M-8'
bind M-9 send-keys 'M-9'
# 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 M-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n M-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n M-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n M-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
# copy paste using tmux
# Use Shift+Middle-click to select and Shift+Middle-click to paste
# or copy from keyboard using https://github.com/wincent/clipper
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "nc localhost 8377"
# or copy from mouse
bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "\
if [ -x /usr/bin/pbcopy ]; then pbcopy; else xclip -i; fi"
# local confs
if-shell 'test -f "$HOME/.tmux.conf.local"' 'source ~/.tmux.conf.local'
# Toggle on/off all keybindings
# From: https://github.com/samoshkin/tmux-config/blob/master/tmux/tmux.conf
# Also, change some visual styles when window keys are off
bind -T root M-` \
set prefix None \;\
set key-table off \;\
set status-style "fg=colour245,bg=colour238" \;\
set status-left-style "fg=colour245,bg=colour238" \;\
set status-right "%H:%M" \;\
set window-status-current-style "fg=colour245,bold,bg=colour238" \;\
set pane-border-style fg=colour238 \;\
set pane-active-border-style fg=colour238 \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off M-` \
set -u prefix \;\
set -u key-table \;\
set -u status-style \;\
set -u status-left-style \;\
set -u status-right \;\
set -u window-status-current-style \;\
set -u pane-border-style \;\
set -u pane-active-border-style \;\
refresh-client -S
# jump back to previous prompt
bind-key b copy-mode\; send -X search-backward ' \$ '
bind -n M-[ copy-mode
# Search like normal with no prefix
# Better Meta + j (for jump) old: Meta + Shift + ? to search backward
bind -n M-? copy-mode \; command-prompt -i -p "(search up)" "send -X search-backward-incremental \"%%%\""
bind -n M-p paste-buffer
# Use search-backward-incremental instead search-backward
bind-key -T copy-mode-vi / command-prompt -i -p "(search down)" "send -X search-forward-incremental \"%%%\""
bind-key -T copy-mode-vi ? command-prompt -i -p "(search up)" "send -X search-backward-incremental \"%%%\""
# Dump the current pane to file so it can be easily searched
bind-key P 'capture-pane' \; capture-pane -S - \; save-buffer ~/tmux.history \; delete-buffer \; display "Dumped History to file ~/.tmux.history"
# Dont jump to end after mouse select
unbind -T copy-mode-vi MouseDragEnd1Pane
bind -T copy-mode-vi y send -X copy-selection
run-shell ~/.tmux-jump/tmux-jump.tmux