-
Notifications
You must be signed in to change notification settings - Fork 9
/
tmux.conf
159 lines (137 loc) · 4.22 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
# Default
set-option -g base-index 1
set-option -wg pane-base-index 1
set-option -g renumber-windows on
set-option -g default-terminal "tmux-256color"
set-option -ga terminal-overrides ",tmux*:Tc,xterm*:Tc"
set-option -g display-time 2000
set-option -g history-limit 50000
set-option -g set-titles on
# H: Host
# I: Current window index
# P: Current pane index
# S: Session name
# T: Current window title
# W: Current window name
# #: A literal '#'
set-option -g set-titles-string "#S: #T"
set-option -g allow-rename on
# Mac OS X fix for pbcopy, pbpaste and launchctl
if-shell 'command -v reattach-to-user-namespace >/dev/null' \
'set-option -g default-command "reattach-to-user-namespace -l $SHELL"'
# https://github.com/tmux/tmux/wiki/Clipboard
set-option -s set-clipboard on
# Bindings
# Default prefix
unbind-key C-b
set-option -g prefix `
bind-key ` send-prefix
bind-key r source-file ~/.tmux.conf
# Windows splitting
bind-key v split-window -h
bind-key s split-window
# Windows with the current working directory
bind-key C new-window -c "#{pane_current_path}"
bind-key V split-window -h -c "#{pane_current_path}"
bind-key S split-window -c "#{pane_current_path}"
# Windows moving
bind-key N swap-window -d -t :+
bind-key P swap-window -d -t :-
# Pane navigation
bind-key O select-pane -t :.-
# Pane resizing
bind-key -r H resize-pane -L 5
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r L resize-pane -R 5
# Pane restarting
bind-key R respawn-pane -k -c "#{pane_current_path}"
# Select the block above the cursor
# https://ianthehenry.com/posts/tmux-copy-last-command/
bind-key -T copy-mode-vi C-k {
send -X clear-selection
send -X start-of-line
send -X start-of-line
send -X cursor-up
send -X start-of-line
send -X start-of-line
if -F "#{m:*❯ *,#{copy_cursor_line}}" {
# If you're on a prompt line
send -X search-forward-text "❯ "
send -X stop-selection
send -X -N 2 cursor-right
send -X begin-selection
send -X end-of-line
send -X end-of-line
if "#{m:*❯ ?*,#{copy_cursor_line}}" {
send -X cursor-left
}
} {
# If you're not on a prompt line
send -X end-of-line
send -X end-of-line
send -X begin-selection
send -X search-backward-text "❯ "
send -X end-of-line
send -X end-of-line
send -X cursor-right
send -X stop-selection
}
}
# Select the block below the cursor
bind-key -T copy-mode-vi C-j {
send -X clear-selection
send -X end-of-line
send -X end-of-line
send -X cursor-right
if -F "#{m:*❯ *,#{copy_cursor_line}}" {
# If you're on a prompt line
send -X search-forward-text "❯ "
send -X stop-selection
send -X -N 2 cursor-right
send -X begin-selection
send -X end-of-line
send -X end-of-line
if "#{m:*❯ ?*,#{copy_cursor_line}}" {
send -X cursor-left
}
} {
# If you're not on a prompt line
send -X begin-selection
send -X search-forward-text "❯ "
send -X start-of-line
send -X start-of-line
send -X cursor-left
send -X stop-selection
}
}
# Set status bar
set-option -g status-interval 1
set-option -g status-style "bg=colour235,fg=green"
set-option -g status-justify right
set-option -g status-left-style "bg=colour235"
# #I: #{window_index}
# #h: #{host_short}
# #W: #{window_name}
set-option -g status-left "#I: #[fg=cyan]#h #[default]#W#{?client_prefix, #[reverse]<Prefix>#[noreverse],} "
set-option -g status-left-length 50
set-option -g status-right-style "bg=colour235,fg=yellow"
# See strftime(3)
set-option -g status-right " [%Y-%m-%d %I:%M%p]"
set-option -wg window-status-style "fg=colour245"
set-option -wg window-status-current-style "fg=cyan"
set-option -wg mode-keys vi
# Allows for faster key repetition
set-option -s escape-time 20
# Aggressive Resize
set-option -wg aggressive-resize on
# TMUX plugin manager is compatible with tmux 1.9
# List of plugins and initialize TMUX plugin manager
# (keep this line at the very bottom of tmux.conf)
set -g @plugin "tmux-plugins/tpm"
set -g @plugin "tmux-plugins/tmux-yank"
set -g @plugin "tmux-plugins/tmux-resurrect"
set -g @resurrect-processes "\"ruby $HOME/bin/server->server\""
set -g @resurrect-strategy-vim "session"
set -g @resurrect-strategy-nvim "session"
run-shell -b "~/.tmux/plugins/tpm/tpm"