-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
157 lines (125 loc) · 6.23 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
# ---------- Options ----------
# Remap prefix from 'Ctrl-b' to 'Ctrl-Space'
unbind C-b
set-option -g prefix 'C-Space'
bind-key 'C-Space' send-prefix
set-window-option -g mode-keys vi
# Make tmux display things in 256 colors
set-option -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ",*256col*:Tc"
set-option -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
# Support undercurl
set-option -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set-option -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
# Set scrollback history
set-option -g history-limit 50000
# Shorten command delay
set-option -sg escape-time 10
# Start windows numbering at 1 (0 by default)
set-option -g base-index 1
# Make pane numbering consistent with windows
set-window-option -g pane-base-index 1
# Rename window to reflect current program
set-window-option -g automatic-rename on
# Renumber windows when a window is closed
set-window-option -g renumber-windows on
# Mouse behavior
set-option -g mouse on
# Set terminal title
set-option -g set-titles on
set-option -g set-titles-string '#h ❐ #S ● #I #W'
# Status Bar
set-option -g status on # Turn the status bar on
set-option -g status-left-length 100
set-option -g status-right-length 100
set-window-option -g clock-mode-style 24 # 24 hour clock
set-option -g status-interval 15 # update frequencey (default 15 seconds)
# ---------- Keys ----------
# Session manager
bind-key -n M-s command-prompt -p find-session 'switch-client -t %%'
bind-key c new-window -c "#{pane_current_path}"
# Window split
bind-key s split-window -v -c "#{pane_current_path}"
bind-key v split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
bind-key | split-window -h -c "#{pane_current_path}"
# Make the current window the first window
bind-key T swap-window -t 1
# Windows navigation
bind-key ^h previous-window # select previous window
bind-key ^p previous-window # select previous window
bind-key ^l next-window # select next window
bind-key ^n next-window # select next window
bind-key n next-window # select next window
bind-key N previous-window # select previous window
bind-key Space last-window # move to last active window
bind-key ^o swap-window -t:+ \; swap-pane -s:-
bind-key ^O swap-window -t:- \; swap-pane -s:+
# Pane navigation
bind-key h select-pane -L # Move left
bind-key l select-pane -R # Move right
bind-key j select-pane -D # Move down
bind-key k select-pane -U # Move up
bind-key > swap-pane -D # Swap current pane with the next one
bind-key < swap-pane -U # Swap current pane with the previous one
# Pane resize
bind-key H resize-pane -L 10 # To the leftward
bind-key L resize-pane -R 10 # To the rightward
bind-key J resize-pane -D 10 # To the dowward
bind-key K resize-pane -U 10 # To the upward
# Copy mode
bind-key Enter copy-mode # Enter copy mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi H send-keys -X start-of-line
bind-key -T copy-mode-vi L send-keys -X end-of-line
bind-key -T copy-mode-vi Escape send-keys -X cancel
# copy to macOS clipboard
if-shell -b 'command -v pbcopy > /dev/null 2>&1' " \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy'; \
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'pbcopy'; \
bind-key -T copy-mode y send-keys -X copy-pipe-and-cancel 'pbcopy'; \
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'pbcopy'; "
# copy to X11 clipboard
if-shell -b 'command -v xsel > /dev/null 2>&1' " \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xsel -i -b'; \
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xsel -i -b'; \
bind-key -T copy-mode y send-keys -X copy-pipe-and-cancel 'xsel -i -b'; \
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xsel -i -b'; "
if-shell -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' " \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -i -selection clipboard >/dev/null 2>&1'; \
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -i -selection clipboard >/dev/null 2>&1'; \
bind-key -T copy-mode y send-keys -X copy-pipe-and-cancel 'xclip -i -selection clipboard >/dev/null 2>&1'; \
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -i -selection clipboard >/dev/null 2>&1'; "
# copy to Windows/WSL clipboard
if-shell -b 'command -v clip.exe > /dev/null 2>&1' " \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'cat | clip.exe'; \
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'cat | clip.exe'; \
bind-key -T copy-mode y send-keys -X copy-pipe-and-cancel 'cat | clip.exe'; \
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'cat | clip.exe'; "
# Edit mode
bind-key -T edit-mode-vi H send-key -X start-of-line
bind-key -T edit-mode-vi L send-key -X end-of-line
bind-key -T edit-mode-vi Escape send-key -X cancel
# Buffers
bind-key b list-buffers # List paster buffers
bind-key p paste-buffer # Paste from the top pate buffer
bind-key P choose-buffer # Choose which buffer to paste from
# Easy config reload
bind-key r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
bind-key e new-window -n "~/.tmux.conf" "sh -c '\${EDITOR:-vim} ~/.tmux.conf && source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'"
# Set colors for command line(messages)
set-option -g message-style bg="default"
# Status Bar
set-option -g status-style fg="default",bg="default"
set-option -g status-justify "left"
set-option -g status-left "#[fg=colour33] ❐ #S "
set-option -g status-right "#[fg=colour135]%m/%d %H:%M "
# Set window notifications
set-option -g visual-activity off
set-option -g monitor-activity off
set-window-option -g window-status-format " #I:#W "
set-window-option -g window-status-current-format "#[fg=colour33] #I:#W "
set-window-option -g window-status-activity-style fg="colour179",bg="default"
# ---------- Local config ----------
if-shell "[ -f ~/.tmux.conf.local ]" "source-file ~/.tmux.conf.local"