-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
145 lines (118 loc) · 5.67 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
# My own configs:
# Enable mouse support
# set -g mouse on
# Enable pane select via mouse
# set -g select-pane on
# Monitor for activity in the window
set -g monitor-activity on
# If on, display a message instead of sending a bell when activity occurs in a window for which the monitor-activity window option is enabled.
# If set to both, a bell and a message are produced.
set -g visual-activity off
# tmux config from tmux-sensible
# see: https://tmuxcheatsheet.com/tmux-plugins-tools/?full_name=tmux-plugins%2Ftmux-sensible
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
# increase scrollback buffer size
set -g history-limit 50000
# tmux messages are displayed for 1,5 seconds in the status bar
set -g display-time 1500
# refresh 'status-left' and 'status-right' more often
set -g status-interval 5
# tmux documentation says our terminal inside tmux should be screen, so we stick with it
set -g default-terminal "screen"
# emacs key bindings in tmux command prompt (prefix + :) are better than
# vi keys, even for vim users
#set -g status-keys emacs
set -g status-keys vi
# 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
# Active window has yellow background in status line
set-window-option -g window-status-current-style bg=yellow,fg=black
# Status line config
# Left status
# Username, Hostname, Tmux-Session Name
set -g status-left "#[fg=black][$USER@#H:#S] "
set -g status-left-length 50
# Right status
# Example with command and date:
#set -g status-right "#[bg=white]Pane: #P#[bg=green] Load: #(cut -d ' ' -f 1-3 /proc/loadavg) #[fg=black][%H:%M, %d.%b %Y]"
set -g status-right "#[bg=white]Pane: #P"
set -g status-right-length 20
# Enable pane status bar
set -g pane-border-status top
# bind-key K is normally: bind-key -T copy-mode-vi K send-keys -X scroll-up
unbind K
# Toogle Pane status bar with this key
bind-key K set -g pane-border-status\; display-message "pane-border-status is now #{?pane-border-status,top,off}"
# Set content of pane status bar
#set -g pane-border-format "#{pane_index} #{pane_current_command}"
# Pane title can also be set manually with:
# select-pane [-t pane #] -T title (for current pane)
# Active pane has yellow border
set -g pane-active-border-style bg=black,fg=yellow
# Set title for current pane via binding
# Default t is clock-mode
unbind t
bind-key t command-prompt -p "New pane title:" 'select-pane -T "%%"'
# Un-/Syncing panes
# Type in all panes in a window. Synced panes will have a red border
# It's also possible to change the pane-border-format based on this
bind-key S set-window-option synchronize-panes on \;\
set-window-option pane-active-border-style bg=black,fg=red \;\
set-window-option pane-border-style bg=black,fg=red \;\
#set-window-option pane-border-format "#{pane_index} #H SYNCED" \;\
display-message "Sync panes ON"
# Unsynced panes will have a yellow border (active one) or grey (inactive)
bind-key U set-window-option synchronize-panes off \;\
set-window-option pane-active-border-style bg=black,fg=yellow \;\
set-window-option pane-border-style bg=black,fg=grey \;\
#set-window-option pane-border-format "#{pane_index} #H" \;\
display-message "Sync panes OFF"
# Scrolling in Panes with ALT+PageUp and ALT+PageDown via CopyBuffer without Ctrl+b+[ first..
# Don't forget to press ESC to exit the copy-buffer (aka scroll mode)
# That works in vi, but we don't really need it, as PageUp/PageDown works fine on itself with the later bindings
#is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
#bind-key -T root -n M-PageUp if-shell "$is_vim" "send-keys Pageup" "copy-mode -u"
#bind-key -T root -n M-PageDown if-shell "$is_vim" "send-keys Pagedown" "copy-mode -u"
#bind-key -T vi-copy -n M-PageUp if-shell "$is_vim" "send-keys Pageup" "copy-mode -u; send-keys Pageup"
#bind-key -T vi-copy -n M-PageDown if-shell "$is_vim" "send-keys Pagedown" "copy-mode -u; send-keys Pagedown"
# That works in panes
bind-key -T root -n M-PageUp copy-mode -u
bind-key -T root -n M-PageDown copy-mode -u
bind-key -T vi-copy -n M-PageUp send-keys Pageup
bind-key -T vi-copy -n M-PageDown send-keys Pagedown
# easier and faster switching between next/prev window
bind-key C-p previous-window
bind-key C-n next-window
bind-key -T root F7 previous-window
bind-key -T root F8 next-window
# Open a new window:
bind-key N new-window
# source .tmux.conf as suggested in `man tmux`
bind-key R source-file ~/.tmux.conf \; display-message "source-file done"
# if prefix is 'C-b'
bind-key C-b send-prefix
bind-key a last-window
# switch panes using Alt-arrow without prefix
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
# Inspired by tmux-pain-control
# see: https://github.com/tmux-plugins/tmux-pain-control
# tmux defines the horizontal and vertical split different then you would expect
# instead of splitting the window in whole horizontally/vertically
# It's the respective Axis that is split. Giving you exactly the opposite result of what one might expect
# See: https://github.com/tmux/tmux/issues/213
# I prefer to change the behaviour and switch the -h and -v behaviour.
# split the current pane vertically
bind-key "v" split-window -h -c "#{pane_current_path}"
# split current pane, full window height, vertically
bind-key "%" split-window -fh -c "#{pane_current_path}"
# split the current pane horizontally
bind-key 'h' split-window -v -c "#{pane_current_path}"
# split current pane, full window width, horizontally
bind-key '"' split-window -fv -c "#{pane_current_path}"