-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtmux.conf
154 lines (123 loc) · 5.35 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
# use C-a, since it's on the home row and easier to hit than C-b
unbind C-b
set -g prefix C-a
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
# Allow the arrow key to be used immediately after changing windows
set -g repeat-time 0
# automatically renumber window numbers on closing a pane (tmux >= 1.7)
set -g renumber-windows on
# focus events enabled for terminals that support them
set -g focus-events on
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# Allow programs to change the window name
setw -g allow-rename on
# use alternate screen
setw -g alternate-screen on
# bell action
set -g bell-action other
# visual bell
set -g visual-bell off
# Easy config reload
bind R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
set -g default-shell $SHELL
set -g default-command "${SHELL}"
# vi is good
setw -g mode-keys vi
# Start panes and windows numbering at 1 (default => 0)
set -g base-index 1
set -g pane-base-index 1
# Mouse behavior
set -g mouse on
# Check if copy-mode or any mouse flags, then send mouse events
# or check if we're in alternate screen end send navigation keys (up, down)
bind -n WheelUpPane if-shell -Ft= '#{?pane_in_mode,1,#{mouse_any_flag}}' \
'send -Mt=' 'if-shell -Ft= "#{alternate_on}" \
"send -t= -N 3 Up" "copy-mode -et="'
bind -n WheelDownPane if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
'send -Mt=' 'if-shell -Ft= "#{alternate_on}" \
"send -t= -N 3 Down" "send -Mt="'
# Scroll 3 lines at a time instead of default 5; don't extend dragged selections.
bind -T copy-mode-vi WheelUpPane send -X -N 3 scroll-up
bind -T copy-mode-vi WheelDownPane send -X -N 3 scroll-down
# Clear selection on single click, select word with two and select line with three
bind -T copy-mode-vi MouseDown1Pane select-pane\; send -X clear-selection\; send -X stop-selection
bind -T copy-mode-vi DoubleClick1Pane select-pane\; send -X select-word\; send -X stop-selection
bind -T copy-mode-vi TripleClick1Pane select-pane\; send -X select-line\; send -X stop-selection
# Enable select word and line outside copymode
bind -n DoubleClick1Pane select-pane\; if-shell -Ft= '#{alternate_on}' \
"send -Mt=" "copy-mode -et=; send -X select-word; send -X stop-selection"
bind -n TripleClick1Pane select-pane\; if-shell -Ft= '#{alternate_on}' \
"send -Mt=" "copy-mode -et=; send -X select-line; send -X stop-selection"
# Select by dragging but don't copy or clear selection when finished
bind -T copy-mode-vi MouseDrag1Pane select-pane\; send -X begin-selection
bind -T copy-mode-vi MouseDragEnd1Pane send -X stop-selection
# Override drag binding outside copymode to quit when scrolling to end
bind -n MouseDrag1Pane select-pane\; if-shell -Ft= '#{mouse_any_flag}' \
'if -Ft= "#{pane_in_mode}" "copy-mode -eM" "send -M"' \
'copy-mode -eM'
# use screen terminfo and enable truecolor
set -s default-terminal "tmux"
set -as terminal-overrides ',xterm*:sitm=\E[3m'
set -as terminal-overrides ',xterm*:Tc'
# keep the terminal profile for vim
set -ag update-environment " TERMINAL_THEME COLORFGBG"
# Keep plenty of history for scrollback
set -g history-limit 102400
# tmux messages are displayed for 4 seconds
set -g display-time 2000
bind : command-prompt
bind r refresh-client
bind L clear-history
bind -n F10 next-window
bind -n F9 previous-window
bind space next-window
bind bspace previous-window
bind enter next-layout
# use vim-like keys for splits and windows
bind c new-window -c '#{pane_current_path}'
bind v split-window -h -c '#{pane_current_path}'
bind s split-window -v -c '#{pane_current_path}'
# 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 "$is_vim" "send C-h" "select-pane -L"
bind -n C-j if "$is_vim" "send C-j" "select-pane -D"
bind -n C-k if "$is_vim" "send C-k" "select-pane -U"
bind -n C-l if "$is_vim" "send C-l" "select-pane -R"
bind -n C-\ if "$is_vim" "send C-\\" "select-pane -l"
bind C-o rotate-window
bind + select-layout main-horizontal
bind = select-layout main-vertical
bind a last-pane
bind q display-panes
bind [ copy-mode
bind ] paste-buffer
# Setup 'v' to begin selection as in Vim
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"
# Set window notifications
setw -g monitor-activity off
set -g visual-activity on
set -g set-titles on
# Don't wrap searches
setw -g wrap-search off
# Panes border colors
set -g pane-active-border-style "fg=#181a1f bg=#282828"
set -g pane-border-style "fg=#181a1f bg=#282828"
# Status Bar
set -g status-interval 60
set -g status-justify left
set -g status-bg default
set -g status-fg white
# Username + hostname
set -g status-right '#[fg=brightred]#(whoami)#[fg=white] ∙ #[fg=yellow]#h '
# Heart
set -g status-left '#[fg=green] ♥ '
# Window inactive
setw -g window-status-format "#{?window_bell_flag,#[bg=yellow],#[bg=blue]}#[fg=black] #I #[fg=black]#{?window_zoomed_flag,#[bg=green]+,}#[fg=white, bg=black] #W "
setw -g window-status-bell-style "none"
# Window current
setw -g window-status-current-format "#[fg=black, bg=red] #I #[fg=black]#{?window_zoomed_flag,#[bg=green]+,}#[fg=white, bg=colour10] #W "
# Copy-mode selection color like vim
setw -g mode-style "bg=colour11"