-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
116 lines (86 loc) · 3.22 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
# Key bindings first, other settings come at the bottom of this file
# set prefix key to ^A
unbind C-b
set -g prefix C-a
# set prefix key to ^B for client inside window
bind-key -n C-b send-prefix
# Source .tmux.conf as suggested in `man tmux`
bind R \
source-file "$DOTFILES_HOME/.tmux.conf" \;\
display "Sourced $DOTFILES_HOME/.tmux.conf"
# Act like vim in copy mode
setw -g mode-keys vi
# Act a bit like vim in pane switching
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Not quite like vim, but at least enable switching windows without moving to arrow keys
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# Easier and faster switching between next/prev/last window
# https://github.com/tmux-plugins/tmux-sensible
bind C-p previous-window
bind C-n next-window
# Toggle mouse on with m
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off with M
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
# Really useful with tmux-cssh or tmux-cluster (tmc)
# https://stackoverflow.com/a/26774547/12178985
bind-key a set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
# Reorder windows easily
bind S-Left swap-window -t -1
bind S-Right swap-window -t +1
# Zoom in on one pane
bind + if-shell "tmux list-panes | wc -l | grep -Fx 1" \
"display-message 'Only one pane in this window!'" \
"new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' ;\
swap-pane -s tmux-zoom.1 ;\
select-window -t tmux-zoom"
unbind -
bind - \
last-window \;\
swap-pane -s tmux-zoom.1 \;\
kill-window -t tmux-zoom
# set first window to index 1 (not 0) to map more to the keyboard layout
set -g base-index 1
setw -g pane-base-index 1
# keep windows renumbered acording to position
set -g renumber-windows on
# Ring the bell if any background window rang a bell
set -g bell-action any
# Watch for activity in background windows
setw -g monitor-activity on
# Some more modern display behaviors
# https://github.com/tmux-plugins/tmux-sensible
# scrollback size
set -g history-limit 100000
# Increase tmux messages display duration from 750ms to 4s
set -g display-time 4000
# Refresh 'status-left' and 'status-right' more often, from every 15s to 5s
set -g status-interval 5
# Super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# Behave better and in more modern fashion in interacting with applications inside tmux:
# pass through xterm keys
set -g xterm-keys on
# Pass through focus events
# This is especially important for Vim/Neovim autoread
set -g focus-events on
# https://github.com/tmux/tmux/wiki/FAQ#what-is-the-escape-time-option-is-zero-a-good-value
# This is especially necessary for Neovim
set-option -sg escape-time 10
# https://github.com/tmux/tmux/wiki/FAQ#i-dont-see-italics-or-italics-and-reverse-are-the-wrong-way-round
# https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal
set -g default-terminal "tmux-256color"