-
Notifications
You must be signed in to change notification settings - Fork 6
/
tmux.conf
121 lines (97 loc) · 3.73 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
# Enable OS X pasteboard.
# http://robots.thoughtbot.com/post/19398560514/how-to-copy-and-paste-with-tmux-on-mac-os-x
set-option -g default-command "reattach-to-user-namespace -l zsh"
# 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 'xterm-256color'
set-window-option -g xterm-keys on
# Prevent delay when pressing Esc.
set -sg escape-time 0
# act like vim
setw -g mode-keys vi
# jump to previous and next window
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# 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 < resize-pane -L 5
bind-key > resize-pane -R 5
bind-key - resize-pane -D 5
bind-key + 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 new-window -c "#{pane_current_path}"
# Disable programs changing window names.
set-window-option -g allow-rename off
# Customize status bar.
set-option -g status-utf8 on
set-option -g status-bg colour10
set-option -g status-fg colour12
set-option -g status-left ' #[bold]#S#[default] '
set-option -g status-left-bg colour12
set-option -g status-left-fg colour10
set-option -g status-right ' %H:%M [%-d] '
set-option -g status-right-bg colour11
set-option -g status-right-fg colour12
set-option -g status-right-length 60
set-option -g status-left-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-bg colour4
set-window-option -g window-status-current-fg colour10
set-window-option -g window-status-current-attr bold
set-window-option -g window-status-current-format ' #I:#W '
set-window-option -g window-status-last-bg colour10
set-window-option -g window-status-last-fg colour12
set-window-option -g window-status-last-attr bold
# Create new session.
bind-key S new-session
# 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 'S'
set -g @resurrect-restore 'R'
# initializes tmux plugin manager:
run-shell ~/.tmux/plugins/tpm/tpm
# Smart pane switching with awareness of vim splits:
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Use full size when different clients to same session are looking at different
# windows.
setw -g aggressive-resize on
# Prevent C-j from being unbound due to tmux-copycat.
# https://github.com/tmux-plugins/tmux-copycat/issues/60
unbind -t vi-copy C-j