-
Notifications
You must be signed in to change notification settings - Fork 6
/
tmux.conf
121 lines (95 loc) · 3.33 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
# Place status bar at top.
set-option -g status-position top
# Enable focus events so vim can use it to save buffers.
set -g focus-events on
# Change the prefix from C-b to C-a. Map a to send C-a.
unbind-key C-b
set -g prefix C-a
bind-key a send-prefix
# Enable mouse for selecting panes and windows, resizing panes, and scrolling.
set -g mouse on
# Use 256 colors.
set -g default-terminal 'tmux-256color'
# Forward key combos involving shift.
set-window-option -g xterm-keys on
# Prevent delay when pressing Esc.
set -sg escape-time 0
# Reduce time for repeatable commands.
set -g repeat-time 300
# act like vim
setw -g mode-keys vi
# navigate panes
bind-key -r C-h select-pane -L
bind-key -r C-j select-pane -D
bind-key -r C-k select-pane -U
bind-key -r C-l select-pane -R
# jump to previous and next window
bind-key C-n select-window -t :+
bind-key C-p select-window -t :-
# move windows
bind-key -r N swap-window -d -t +1
bind-key -r P swap-window -d -t -1
# list sessions in alphabetical order
bind-key s choose-tree -s -O name -N -Z
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# increase scrollback lines
set -g history-limit 10000
# resize panes like vim
bind-key -r < resize-pane -L 5
bind-key -r > resize-pane -R 5
bind-key -r - resize-pane -D 5
bind-key -r + resize-pane -U 5
# kill the scroll back
bind-key K clear-history
# better mnemonics for splitting
bind-key \\ split-window -h -c "#{pane_current_path}"
bind-key = split-window -v -c "#{pane_current_path}"
# Open new windows with current path.
bind C-c new-window -c "#{pane_current_path}"
# Unbind c to prevent accidental window creation after triggering a repeatable
# command.
unbind c
# Disable programs changing window names.
set-window-option -g allow-rename off
# Customize status bar.
set-option -g status-style bg=colour18,fg=colour07
set-option -g status-left ' #S '
set-option -g status-left-style bg=colour07,fg=colour18,bold
set-option -g status-left-length 60
set-option -g status-right ' %H:%M [%-d] '
set-option -g status-right-style bg=colour08,fg=colour07
set-option -g status-right-length 60
set-option -g status-interval 60
# Highlight active window.
set-window-option -g window-status-separator ''
set-window-option -g window-status-format ' #I:#W '
set-window-option -g window-status-current-style bg=colour12,fg=colour18,bold
set-window-option -g window-status-current-format ' #I:#W '
set-window-option -g window-status-last-style bg=colour18,fg=colour07,bold
# Create new session.
bind-key S new-session
# Use full size when different clients to same session are looking at different
# windows.
setw -g aggressive-resize on
# List of tmux plugin manager plugins:
set -g @tpm_plugins " \
tmux-plugins/tpm \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-open \
tmux-plugins/tmux-copycat \
tmux-plugins/tmux-yank \
tmux-plugins/tmux-continuum \
nhdaly/tmux-scroll-copy-mode \
"
# Automatically restore tmux sessions when opening tmux:
set -g @continuum-restore 'on'
set -g @resurrect-save 'M-s'
set -g @resurrect-restore 'M-r'
set -g @resurrect-capture-pane-contents 'on'
# initializes tmux plugin manager:
run-shell ~/.tmux/plugins/tpm/tpm
# Record tmux command history:
set -g history-file ~/.tmux_history