-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.tmux.conf
160 lines (127 loc) · 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
# Michael's .tmux.conf
# (https://github.com/kmhofmann/dotfiles)
# =======================================
# Bind <Prefix> to Ctrl-a, and unbind Ctrl-b
set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
# Disable mouse integration
set-option -g mouse off
# Set delay between prefix and command
set-option -s escape-time 1
# Make commands repeatable for a bit longer
set-option -g repeat-time 1000
# Scrollback buffer for up to 100,000 lines
set-option -g history-limit 100000
# One-based indexing of windows and panes
# (I know it's wrong, but easier to reach on the keyboard)
set-option -g base-index 1
set-option -w -g pane-base-index 1
set-option -g renumber-windows on
# Enable passing through of focus events
set-option -g focus-events on
# <Prefix>-r reloads the .tmux.conf
bind-key r source-file ~/.tmux.conf \; display "Reloaded tmux.conf"
# <Prefix>-R restarts the pane, killing everything that's in it
bind-key R respawn-pane -k
# <Prefix>-n also creates a new window, in addition to <Prefix>-c
unbind-key n
bind-key n new-window
# vim-like bindings in copy mode
set-option -w -g mode-keys vi
## More vim-like bindings for entering copy-mode and pasting
unbind-key p
bind-key p paste-buffer
# Inspired by https://shapeshed.com/custom-vim-bindings-in-tmux-2-4/
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6- | sed 's/[A-Za-z]*//g')"
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.4" | bc)" = 1 ]' \
" \
bind-key -t vi-copy 'Escape' cancel; \
bind-key -t vi-copy 'v' begin-selection; \
bind-key -t vi-copy 'V' select-line; \
bind-key -t vi-copy 'r' rectangle-toggle; \
bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard' \
"
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' \
" \
bind-key -T copy-mode-vi 'Escape' send -X cancel; \
bind-key -T copy-mode-vi 'v' send -X begin-selection; \
bind-key -T copy-mode-vi 'V' send -X select-line; \
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle; \
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard' \
"
# Use pipe (|) and dash (-) to split off panes (and use current path)
# (% and " can still be used to split off panes using the initial path.)
bind-key | split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
# Switch windows using <PREFIX>-<Ctrl-j/k>
bind-key -r C-j select-window -t :-
bind-key -r C-k select-window -t :+
# Switch windows using <Shift-Left/Right>
bind-key -n S-Left previous-window
bind-key -n S-Right next-window
# Move current window with <PREFIX>-<Ctrl-h/l>
# - tmux >= 3.0
bind-key -r C-h swap-window -t -1\; select-window -t -1
bind-key -r C-l swap-window -t +1\; select-window -t +1
# - tmux < 3.0
#bind-key -r C-h swap-window -t -1
#bind-key -r C-l swap-window -t +1
# Move current window with <Ctrl-Shift-Left/Right>
# - tmux >= 3.0
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
# - tmux < 3.0
#bind-key -n C-S-Left swap-window -t -1
#bind-key -n C-S-Right swap-window -t +1
# Switch panes using <PREFIX>-<h/j/k/l>
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Switch panes using <Alt-Left/Right/Up/Down>
bind-key -n M-Left select-pane -L
bind-key -n M-Right select-pane -R
bind-key -n M-Up select-pane -U
bind-key -n M-Down select-pane -D
# Resize panes using <PREFIX>-<H/J/K/L>
bind-key -r H resize-pane -L 2
bind-key -r J resize-pane -D 2
bind-key -r K resize-pane -U 2
bind-key -r L resize-pane -R 2
# Resize panes using <Alt-Shift-Left/Right/Up/Down>
bind-key -n M-S-Left resize-pane -L 2
bind-key -n M-S-Right resize-pane -R 2
bind-key -n M-S-Up resize-pane -U 2
bind-key -n M-S-Down resize-pane -D 2
# --------------------
# tmux appearance:
# (YMMV regarding (un)commenting the next line.)
set-option -g default-terminal "tmux-256color"
set-option -sa terminal-overrides ",xterm*:Tc"
# Don't distract me
set-option -w -g monitor-activity off
set-option -g visual-activity off
# Aggressively resize the chosen window
set-option -w -g aggressive-resize on
# set-option -g status-utf8 on
set-option -g status-justify centre
set-option -g status-left-length 20
set-option -g status-right-length 60
set-option -g status-left "#[bg=colour232]#[fg=blue][#S] #[fg=yellow]W#I #[fg=cyan]P#P"
set-option -g status-right '#[bg=colour232]#[fg=blue]#H | %d %b %R'
# Style the command line
set-option -g message-style fg=colour255,bold,bg=colour90
# Style the status bar
set-option -g status-style bg=colour232
set-option -w -g window-status-style fg=colour79,bg=black
set-option -w -g window-status-current-style fg=colour250,bold,bg=colour90
# Style the pane borders
set-option -w -g pane-border-style fg=colour32,bg=black
set-option -w -g pane-active-border-style fg=colour250,bg=colour90
# Style the panes
#set-option -w -g window-active-style fg=white,bg=black
#set-option -w -g window-style fg=white,bg=black
# Style the clock
set-option -w -g clock-mode-colour colour32
set-option -w -g clock-mode-style 24