-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
139 lines (109 loc) · 4.75 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
# ==========================
# === General settings ===
# ==========================
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
set -ga terminal-features "*:hyperlinks"
set -g history-limit 20000
set -g buffer-limit 20
set -sg escape-time 0
set -g display-time 1500
set -g remain-on-exit off
set -g repeat-time 300
setw -g allow-rename off
setw -g automatic-rename off
setw -g aggressive-resize on
set-option -g renumber-windows on
set-option -g focus-events on
# Change prefix key to C-a, easier to type, same to "screen"
unbind C-b
set -g prefix 'C-a'
# Set parent terminal title to reflect current window in tmux session
set -g set-titles on
set -g set-titles-string "#I:#W"
# Start index of window/pane with 1, because we're humans, not computers
set -g base-index 1
setw -g pane-base-index 1
# Enable mouse support
set -g mouse on
# ==========================
# === Key bindings ===
# ==========================
# toggle pane title visibility
bind T run 'zsh -c "arr=( off top ) && tmux setw pane-border-status \${arr[\$(( \${arr[(I)#{pane-border-status}]} % 2 + 1 ))]}"'
# rename pane
bind t command-prompt -p "(rename-pane)" -I "#T" "select-pane -T '%%'"
# Edit configuration and reload
bind C-e new-window -n 'tmux.conf' "sh -c '\${EDITOR:-nvim} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display \"Config reloaded\"'"
# Reload tmux configuration
bind C-r source-file ~/.tmux.conf \; display "Config reloaded"
# new window and retain cwd
bind c new-window -c "#{pane_current_path}"
# Prompt to rename window right after it's created
set-hook -g after-new-window 'command-prompt -I "#{window_name}" "rename-window '%%'"'
# Rename session and window
bind r command-prompt -I "#{window_name}" "rename-window '%%'"
bind R command-prompt -I "#{session_name}" "rename-session '%%'"
# Split panes
bind | split-window -h -c "#{pane_current_path}"
bind _ split-window -v -c "#{pane_current_path}"
# Select pane and windows
# bind -r C-[ previous-window
# bind -r C-] next-window
bind -r [ select-pane -t :.-
bind -r ] select-pane -t :.+
bind -r C-o swap-pane -D
# Zoom pane
bind + resize-pane -Z
# Link window
bind L command-prompt -p "Link window from (session:window): " "link-window -s %% -a"
# Kill pane/window/session shortcuts
bind x kill-pane
bind X kill-window
bind C-x confirm-before -p "kill other windows? (y/n)" "kill-window -a"
bind Q confirm-before -p "kill-session #S? (y/n)" kill-session
# Detach from session
bind d detach
bind D if -F '#{session_many_attached}' \
'confirm-before -p "Detach other clients? (y/n)" "detach -a"' \
'display "Session has only 1 client attached"'
# Hide status bar on demand
# bind C-s if -F '#{s/off//:status}' 'set status off' 'set status on'
# ================================================
# === Copy mode, scroll and clipboard ===
# ================================================
set -s set-clipboard on
bind P paste-buffer
# Prefer vi style key table
setw -g mode-keys vi
bind v copy-mode
# For binding 'y' to copy and exiting selection mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
# =====================================
# === Appearence and status bar ===
# ======================================
set -g status-style fg=grey,bg=black
set -g status-position top
set -g status-justify left
set -g window-status-separator ""
set -g status-left "#[bg=colour241,fg=colour248] #S #[bg=colour237,fg=colour241,nobold,noitalics,nounderscore]"
setw -g window-status-current-format "#[bg=colour214,fg=colour237,nobold,noitalics,nounderscore]#[bg=colour214,fg=colour239] #I #[bg=colour214,fg=colour239,bold] #W#{?window_zoomed_flag,*Z,} #[bg=colour237,fg=colour214,nobold,noitalics,nounderscore]"
setw -g window-status-format "#[bg=colour239,fg=colour237,noitalics]#[bg=colour239,fg=colour223] #I #[bg=colour239,fg=colour223] #W #[bg=colour237,fg=colour239,noitalics]"
set -g status-right "#{prefix_highlight} #[bg=colour241,fg=colour248]#($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --colors -a 0 -g 0 --powerline-right --interval 1) #[fg=green]#[fg=black,bg=green] #{network_bandwidth} #[default]"
# ============================
# === Plugins ===
# ============================
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'xamut/tmux-network-bandwidth'
set -g @plugin 'thewtex/tmux-mem-cpu-load'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-save 'S'
set -g @resurrect-restore 'R'
# Plugin properties
set -g @open-S 'https://www.google.com/search?q='
# Run all plugins' scripts
run '~/.tmux/plugins/tpm/tpm'