aboutsummaryrefslogtreecommitdiff
path: root/.config/tmux/tmux.conf
blob: 73cb1806c48b07a95582768d8d0e2c4d83f3e555 (plain)
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
# set default shell
set -g default-command "${SHELL}"

# set prefix to ctrl+a
set -g prefix C-a
bind C-a send-prefix
unbind C-b

# reload configuration
bind r source-file ~/.config/tmux/tmux.conf \; run "printf '# Reload tmux configuration\n' | tmux load-buffer - && tmux paste-buffer"

# settings
set -g base-index 1
set -g history-limit 10000
set -g mode-keys vi
set -g monitor-activity on
set -g mouse on
set -g pane-base-index 1
set -g pane-border-format ""
set -g pane-border-status top
set -g status on
set -g status-left ''
set -g status-position top
set -g status-right ''
set -g visual-activity off
set -sg escape-time 1
setw -g window-status-current-format " #I "
setw -g window-status-format " #I "

# colours
set -g status-bg color0
set -g pane-border-style fg=colour9
set -g pane-active-border-style fg=colour9
setw -g window-status-style fg=colour3
setw -ga window-status-current-style bg=color9

# cycle windows
bind -n S-Right next-window     # shift + -->
bind -n S-Left previous-window  # shift + <--

# y and p as in vim
unbind p
bind -n M-p paste-buffer
bind -n M-e copy-mode
bind-key -T copy-mode-vi v   send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle          \; send -X begin-selection
bind-key -T copy-mode-vi y   send-keys -X copy-selection-and-cancel \; run "tmux save-buffer - | xsel -i"

# middle mouse paste
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel -i"
bind -T root MouseDown2Pane run -b "xsel -o | tmux load-buffer - && tmux paste-buffer -s ' '"

# double click select
bind-key -n DoubleClick1Pane \
    select-pane \; \
    copy-mode -M \; \
    send-keys -X select-word \; \
    run-shell "sleep .25s" \; \
    send-keys -X copy-pipe-and-cancel "xsel -i"

# triple click select
bind-key -n TripleClick1Pane \
    select-pane \; \
    copy-mode -M \; \
    send-keys -X select-line \; \
    run-shell "sleep .25s" \; \
    send-keys -X copy-pipe-and-cancel "xsel -i"

# split pane commands
bind | split-window -h
bind - split-window -v

# alt vim keys without prefix key to switch panes
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R

# alt arrow keys without prefix key to switch panes
bind -n M-Down  select-pane -D
bind -n M-Left  select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up    select-pane -U

# alt vim keys without prefix to resize panes
bind -n M-H resize-pane -L 5
bind -n M-J resize-pane -D 5
bind -n M-K resize-pane -U 5
bind -n M-L resize-pane -R 5

# session saving
set -g @resurrect-processes 'make hugo dmesg journalctl'
run-shell ~/.config/tmux/plugins/tmux-resurrect/resurrect.tmux