-
Notifications
You must be signed in to change notification settings - Fork 8
/
.tmux.conf
145 lines (120 loc) · 4.27 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
# Remap <prefix> from <Ctrl-b> to <Ctrl-a>
set -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
# Make `<prefix> r` reload the config file
unbind-key r
bind-key r source-file ~/.tmux.conf
# Start windows numbering at 1
set -g base-index 1
# Renumber windows when a window is closed
set -g renumber-windows on
# Use Vim shortcuts
setw -g mode-keys vi
# Make pane numbering consistent with windows
setw -g pane-base-index 1
# Rename window to reflect current program
setw -g automatic-rename on
# Enable mouse support
set -g mouse on
# Increase scrollback buffer size
set -g history-limit 10000
# Enable true color
set -g default-terminal 'xterm-256color'
set -ga terminal-overrides ',*256col*:Tc'
# Split current window horizontally
bind-key - split-window -v
# Split current window vertically
bind-key | split-window -h
# Pane navigation
bind-key h select-pane -L # Move left
bind-key j select-pane -D # Move down
bind-key k select-pane -U # Move up
bind-key l select-pane -R # Move right
# Pane resizing
bind-key -r H resize-pane -L 2
bind-key -r J resize-pane -D 2
bind-key -r K resize-pane -U 2
bind-key -r L resize-pane -R 2
# Copy mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# Connect tmux to the macOS clipboard service
if-shell -b 'command -v reattach-to-user-namespace &> /dev/null' {
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-no-clear 'reattach-to-user-namespace pbcopy'
bind-key -T copy-mode DoubleClick1Pane {
select-pane
send-keys -X select-word
send-keys -X copy-pipe-no-clear 'reattach-to-user-namespace pbcopy'
}
bind-key -T copy-mode TripleClick1Pane {
select-pane
send-keys -X select-line
send-keys -X copy-pipe-no-clear 'reattach-to-user-namespace pbcopy'
}
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear 'reattach-to-user-namespace pbcopy'
bind-key -T copy-mode-vi DoubleClick1Pane {
select-pane
send-keys -X select-word
send-keys -X copy-pipe-no-clear 'reattach-to-user-namespace pbcopy'
}
bind-key -T copy-mode-vi TripleClick1Pane {
select-pane
send-keys -X select-line
send-keys -X copy-pipe-no-clear 'reattach-to-user-namespace pbcopy'
}
}
# Connect tmux to the Linux clipboard service
if-shell -b 'command -v xclip &> /dev/null' {
bind-key -T copy-mode C-w send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard -i > /dev/null'
bind-key -T copy-mode M-w send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard -i > /dev/null'
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-no-clear 'xclip -selection clipboard -i > /dev/null'
bind-key -T copy-mode DoubleClick1Pane {
select-pane
send-keys -X select-word
send-keys -X copy-pipe-no-clear 'xclip -selection clipboard -i > /dev/null'
}
bind-key -T copy-mode TripleClick1Pane {
select-pane
send-keys -X select-line
send-keys -X copy-pipe-no-clear 'xclip -selection clipboard -i > /dev/null'
}
bind-key -T copy-mode-vi C-j send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard -i > /dev/null'
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard -i > /dev/null'
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard -i > /dev/null'
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear 'xclip -selection clipboard -i > /dev/null'
bind-key -T copy-mode-vi DoubleClick1Pane {
select-pane
send-keys -X select-word
send-keys -X copy-pipe-no-clear 'xclip -selection clipboard -i > /dev/null'
}
bind-key -T copy-mode-vi TripleClick1Pane {
select-pane
send-keys -X select-line
send-keys -X copy-pipe-no-clear 'xclip -selection clipboard -i > /dev/null'
}
}
# Window navigation
bind-key < {
swap-window -t -1
select-window -p
}
bind-key > {
swap-window -t +1
select-window -n
}
if-shell -b '[ -f ~/.tmux/plugins/tpm/tpm ]' {
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-resurrect \
Morantron/tmux-fingers \
'
}
# User defined overrides
if-shell -b '[ -f ~/.tmux.conf.local ]' {
source ~/.tmux.conf.local
}
# Initialize TMUX plugin manager
if-shell -b '[ -f ~/.tmux/plugins/tpm/tpm ]' {
run-shell -b '~/.tmux/plugins/tpm/tpm'
}