-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
168 lines (131 loc) · 5.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
# Enable mouse mode (tmux 2.1 and above)
set-option -g mouse on
# Toggle mouse with ^M; then report it's new status
bind-key C-m set-option -g mouse \; display-message 'Mouse #{?mouse,on,off}'
# allow selecting the pane with the mouse wheel
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
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# 256 colors
set -g default-terminal "screen-256color"
# Source Tmuxline configuration
# if-shell "test -f .tmuxline.conf" "source .tmuxline.conf"
# Reload config hotkey
bind-key r source-file ~/.tmux.conf\; display-message "Configuration reloaded."
# Better window renaming
bind-key , command-prompt -p "Enter window name:" "rename-window '%%'"
# Number windows starting at 1
set -g base-index 1
# Sublime Text $(subl) support
set-option -g default-command "reattach-to-user-namespace -l bash"
# split panes using | and -
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# when the output of the inner terminal exceeds the terminal’s
# height it is allowed to spill over into the outer terminal’s
# scrollback history
# scrollback buffer n lines
set -g history-limit 10240
# The panes
set -g pane-border-style bg=colour235
set -g pane-border-style fg=colour238
set -g pane-active-border-style bg=colour236
set -g pane-active-border-style fg=colour12
set -g display-panes-time 4000
#-------------------------------------------------------#
# Pane colours
#-------------------------------------------------------#
# set inactive/active window styles
set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=black'
# Pane border
set -g pane-border-style bg=colour235
set -g pane-border-style fg=colour238
set -g pane-active-border-style bg=colour236
set -g pane-active-border-style fg=colour51
# Pane Status
set -g pane-border-status
set -g pane-border-format "#P: #{pane_current_path} (#{pane_current_command})"
#-------------------------------------------------------#
# Navigation between vim and tmux panes made easy
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(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"
# Reload config hotkey
bind-key r source-file ~/.tmux.conf\; display-message "Configuration reloaded."
# Better window renaming
bind-key , command-prompt -p "Enter window name:" "rename-window '%%'"
# Number windows starting at 1
set -g base-index 1
# Navigation between vim and tmux panes made easy
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(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"
# Fix LSOpenURLsWithRole() error on OS X. Requires reattach-to-user-namespace
# to be installed.
set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"
##############
# Copy/Pasta #
##############
# Setup copy paste like vim for copy mode
#bind-key -T copy-mode-vi v begin-selection
bind-key -T copy-mode-vi v send-keys -X begin-selection
# Update default binding of enter to use copy-pipe
unbind -T copy-mode-vi Enter
#bind-key -T vi copy-mode-vi Enter copy-pipe "reattach-to-user-namespace pbcopy"
bind -Tcopy-mode-vi M-y send -X copy-pipe "xclip -i -sel p -f | xclip -i -sel c" \; display-message "copied to system clipboard"
# Bind ']' to use pbpaste
bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
##############
# Status Bar #
##############
# visual notification of activity in other windows
setw -g monitor-activity on
set -g visual-activity on
# window status
set -g status-position bottom
set -g status-bg black
set -g status-fg colour137
set -g status-style "bold"
set -g status-left ''
# Doing too much™ in the Status Bar
# Show what's playing on Spotify
# Show next gcal event
# Show date and time
# Use/Abuse emojis
set -g status-right '#[fg=green] 👿 #(spotify status | sed -n 2,5p | sed -e '2d' | cut -f2- -d: | tr "\n" " ") 📅 #[fg=yellow] (#(cat ~/.gcalcli_next_event | cut -f -3 -d" ")) #[fg=cyan] #(cat ~/.gcalcli_next_event | cut -f 4- -d " ") #[fg=colour9,bold] 🦋 🐸 🦑 %A %b %d, %Y 🕒 #[fg=colour15] %r %Z'
set -g status-right-length 200
set -g status-left-length 20
set -g status-interval 1 # Fix annoying time delay
setw -g window-status-current-style fg=colour81
setw -g window-status-current-style bg=colour238
setw -g window-status-current-style "bold"
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
setw -g window-status-style fg=colour138
setw -g window-status-style bg=colour235
setw -g window-status-style "none"
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
setw -g window-status-bell-style "bold"
setw -g window-status-bell-style fg=colour255
setw -g window-status-bell-style bg=colour1
set -g default-terminal "screen"
set -g terminal-overrides 'xterm*:smcup <at> :rmcup <at> :colors=256'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'