-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
102 lines (80 loc) · 3.31 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
# change the default prefix
unbind C-b
set -g prefix C-Space
set -g allow-rename off
# don't wait for me, tmux
set -g escape-time 0
# start window numbering @ 1
set -g base-index 1
set -g default-terminal "xterm-kitty"
# true color still works without the following line
# set -ga terminal-overrides ",screen-256color:Tc"
set -g history-limit 30000
# leave no gaps after closing any intermediate window
set -g renumber-windows on
# emacs key bindings in tmux command prompt (prefix + :)
set -g status-keys emacs
# move the 'window list' status
set -g status-justify centre
set -g focus-events on
# super useful when using "grouped sessions" and multi-monitor setup
# setw -g aggressive-resize on
# mouse support
setw -g mouse on
# requried by 'tmuxinator'
setw -g pane-base-index 1
setw -g window-status-current-style bg=red
unbind r
bind r source-file ~/.tmux.conf\; display-message "Config reloaded."
# Smart pane switching with awareness of vim splits
# https://github.com/christoomey/vim-tmux-navigator#tmux
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(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"
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind -T copy-mode-vi C-h select-pane -L
bind -T copy-mode-vi C-j select-pane -D
bind -T copy-mode-vi C-k select-pane -U
bind -T copy-mode-vi C-l select-pane -R
bind -T copy-mode-vi 'C-\' select-pane -l
# https://github.com/christoomey/vim-tmux-navigator#restoring-clear-screen-c-l
bind C-l send-keys 'C-l'
unbind % # remove default binding
bind S list-sessions
bind v split-window -h -c '#{pane_current_path}' # horizontal columns
bind s split-window -v -c '#{pane_current_path}' # vertical rows
bind = select-layout even-vertical
bind | select-layout even-horizontal
bind -r "<" swap-window -t -1 \; previous-window
bind -r ">" swap-window -t +1 \; next-window
# swap to last used window
bind C-Space last-window
# resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# start copy mode when scrolling
bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
bind -T copy-mode-vi WheelUpPane send -X scroll-up
bind -T copy-mode-vi WheelDownPane send -X scroll-down
# Shift Left/Right to switch windows in tmux without the tmux prefix
bind -n S-Left previous-window
bind -n S-Right next-window
unbind [
bind Escape copy-mode
# default key for 'previous-window'
unbind p
bind p paste-buffer
# [copy mode] type 'v' to start selection
bind -T copy-mode-vi v send -X begin-selection
# copy selected text to the system's clipboard
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"