-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.tmux.conf
180 lines (167 loc) · 6.5 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
## Plugins using TPM
# TPM default plugin
set -g @plugin 'tmux-plugins/tpm'
# Save and restore sessions, auto start server
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Session management
set -g @plugin 'tmux-plugins/tmux-sessionist'
# Clipboard integration
set -g @plugin 'tmux-plugins/tmux-yank'
# Open files or search in google from terminal
set -g @plugin 'tmux-plugins/tmux-open'
# Highlight tmux prefix in status bar
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# Control panes easily
set -g @plugin 'tmux-plugins/tmux-pain-control'
# Uptime in status bar
set -g @plugin 'robhurring/tmux-uptime'
## Key bindings
# Drag to re-order windows
bind -n MouseDrag1Status swap-window -t=
# Double click on the window list to open a new window
bind -n DoubleClick1Status new-window
# Copy selection with middle mouse
unbind -n -T copy-mode-vi MouseDragEnd1Pane
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; \
run "tmux save-buffer - | xclip -sel primary -f | xclip -sel clipboard > /dev/null"
# Paste from clipboard with middle mouse
unbind-key MouseDown2Pane
bind-key -n MouseDown2Pane \
run "X=$(xclip -o -sel clipboard); tmux set-buffer \"$X\"; \
tmux paste-buffer -p; tmux display-message 'pasted!'"
# Change window with Shift + arrow (without prefix)
bind -n S-Left previous-window
bind -n S-Right next-window
## System
# History scroll back size
set -g history-limit 50000
# Enable mouse interaction
set -g mouse on
# Use vim movement for copy mode
setw -g mode-keys vi
# tmux messages are displayed for 4 seconds
set -g display-time 4000
# Refresh 'status-left' and 'status-right' more often
set -g status-interval 5
# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access
set -s escape-time 50
# Upgrade $TERM to be colorful
set -g default-terminal "screen-256color"
# Focus events enabled for terminals that support them
set -g focus-events on
# Useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# Start pane/window numbering at 1 and re-number automatically
set -g renumber-windows on
set -g base-index 1
setw -g pane-base-index 1
# Prevent window auto-renaming when a process is launched
set -g allow-rename off
# Set parent terminal title to reflect current window in tmux session
set -g set-titles on
set -g set-titles-string "#(whoami)@#h | session: #S | pane: #I [#W]"
# Activity
set -g monitor-activity on
set -g visual-activity off
# Prompt to rename window after it is created
set-hook -g after-new-window 'command-prompt -I "#{window_name}" "rename-window '%%'"'
## Nested tmux sessions support
# Use <F12> to turn off all key bindings and prefix handling on local session,
# so that all keystrokes are passed to remote session
bind -T root F12 \
set prefix None \;\
set key-table off \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
refresh-client -S
# Add "OFF" to status line when key bindings and prefix handling is disabled on session
wg_is_keys_off="#[fg=$color_light,bg=$color_window_off_indicator]\
#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'OFF')\
#[default]"
## Color scheme (gruvbox dark)
set -g status "on"
# Default statusbar color
set -g status-style bg=colour237,fg=colour223
# Default window title colors
setw -g window-status-style bg=colour214,fg=colour237
# Default window with an activity alert
setw -g window-status-activity-style bg=colour237,fg=colour248
# Active window title colors
setw -g window-status-current-style bg=red,fg=colour237
# Pane border
set -g pane-active-border-style fg=colour250
set -g pane-border-style fg=colour237
# Message infos
set -g message-style bg=colour239,fg=colour223
# Writing commands inactive
set -g message-command-style bg=colour239,fg=colour223
# Pane number display
set -g display-panes-active-colour colour250
set -g display-panes-colour colour237
# Clock
setw -g clock-mode-colour colour109
# Bell
setw -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg
## Theme settings mixed with colors (gruvbox dark)
set -g status-justify "left"
set -g status-left-style none
set -g status-left-length "80"
set -g status-right-style none
set -g status-right-length "80"
## Status line (gruvbox dark)
# Left
setw -g window-status-separator ""
setw -g window-status-current-format "\
#[fg=colour239, bg=colour214] #I\
#[fg=colour239, bg=colour214, bold] #W "
setw -g window-status-format "\
#[fg=colour223, bg=colour239] #I\
#[fg=colour223, bg=colour239] #W "
set -g status-left "#[fg=colour248, bg=colour241] #S "
# Right
set -g status-right "$wg_is_keys_off #{prefix_highlight}\
#[fg=colour214, bg=colour239] ↑ #{uptime} \
#[fg=colour246, bg=colour239] %Y-%m-%d %H:%M \
#[fg=colour237, bg=colour248] #(whoami)@#h "
## Prefix highlight colors ['tmux-plugins/tmux-prefix-highlight']
# Enable copy and sync modes
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
# Colors - wait mode
set -g @prefix_highlight_fg 'colour239'
set -g @prefix_highlight_bg 'colour214'
# Colors - copy mode
set -g @prefix_highlight_copy_mode_attr 'fg=colour239,bg=colour214,bold'
# Colors - sync mode
set -g @prefix_highlight_sync_mode_attr 'fg=colour239,bg=colour214'
# Prompt - wait mode
set -g @prefix_highlight_prefix_prompt 'Wait'
# Prompt - copy mode
set -g @prefix_highlight_copy_prompt 'Copy'
# Prompt - sync mode
set -g @prefix_highlight_sync_prompt 'Sync'
## Session state management ['tmux-plugins/tmux-resurrect', 'tmux-plugins/tmux-continuum']
# Automatically start tmux server on boot
set -g @continuum-boot 'on'
# On boot - open a new iterm window and run tmux (approve the script in Preferences when prompted)
set -g @continuum-boot-options 'iterm'
# Restore last saved environment when tmux server is started
set -g @continuum-restore 'on'
# Save session state every 10 minutes
set -g @continuum-save-interval '10'
# Save and restore window geometry
set -g @resurrect-hook-post-save-all 'eval $(xdotool getwindowgeometry --shell $WINDOWID); \
echo 0,$X,$Y,$WIDTH,$HEIGHT > $HOME/.tmux/resurrect/geometry'
set -g @resurrect-hook-pre-restore-all 'wmctrl -i -r $WINDOWID -e \
$(cat $HOME/.tmux/resurrect/geometry)'
# Restore vim sessions if Session.vim file is present
set -g @resurrect-strategy-vim 'session'
## File/link opening, text searching ['tmux-plugins/tmux-open']
# Search text URL
set -g @open-S 'https://www.google.com/search?q='
### Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'