-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
111 lines (104 loc) · 4.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
103
104
105
106
107
108
109
110
111
# https://github.com/tmux/tmux/wiki/Getting-Started#list-of-useful-options
# n.b. tmux will infer the type from the option name, so -s|-w options to the set command can be omitted.
set -g allow-rename off
# https://stackoverflow.com/a/9630367
set -g automatic-rename off
set -g base-index 1
set -g bell-action none
# https://wiki.archlinux.org/index.php/tmux#Key_bindings#Setting_the_correct_term
set -g default-command bash
# https://github.com/neovim/neovim/issues/7353#issuecomment-334279343
# macOS doesn't include a tmux-256color terminfo
# Confirm with: `tmux info | grep Tc`
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
# tmux >v3.2
set -ga terminal-features ",*256color*:RGB"
# Set duration for `display-message`
set -g display-panes-time 2000
set -g display-time 2000
# Fix exit-insert-double-esc issue in vim: https://unix.stackexchange.com/a/25638
set -g escape-time 0
set -g history-limit 10000
set -g mode-keys vi
set -g monitor-activity on
set -g monitor-bell on
set -g mouse on
set -g pane-base-index 1
set -g renumber-windows on
set -g set-titles on
set -g status-keys vi
set -g status-position top
set -g visual-activity off
set -g visual-bell on
set -g visual-silence off
# Formatting and colors
# Colours may be one of black, red, green, yellow, blue, magenta, cyan, white
# for the standard terminal colours; brightred, brightyellow and so on for the
# bright variants; colour0 to colour255 for the colours from the 256-colour
# palette; default for the default colour; or a hexadecimal RGB colour such as #882244.
# https://cassidy.codes/blog/2019-08-03-tmux-colour-theme/
# Test bell by entering the following then switching tabs: sleep 2 && echo -e '\a'
set -g message-command-style bg=#33a999,fg=#F8F2E0
set -g message-style bg=#70C0B1,fg=#F8F2E0
set -g window-status-separator ""
# https://stackoverflow.com/a/61764869 (see comments)
set -g status-left "#h[#S]"
set -g status-left-length 36
set -g status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,}#{=100:pane_title}"
set -g status-right-length 36
set -g window-size largest
set -g window-status-current-format ' #I:#W#F '
#set -g window-status-current-style 'reverse'
set -g window-status-format ' #I:#W#F '
# https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
unbind t
bind t new-window
bind m set -g mouse \; display "Mouse: #{?mouse,On,Off}"
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
bind | split-window -h
bind - split-window -v
bind -n C-h select-window -p
bind -n C-l select-window -n
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D
bind -n M-H resize-pane -L 10
bind -n M-L resize-pane -R 10
bind -n M-K resize-pane -U 10
bind -n M-J resize-pane -D 10
# https://stackoverflow.com/a/10553992
bind -n C-k clear-history
# Copy/paste
bind P paste-buffer
set -g set-clipboard off
# Disable "release mouse drag to copy and exit copy-mode" to prevent the
# viewport from jumping around on selection
# Ref:
# https://github.com/tmux/tmux/issues/140
# https://superuser.com/questions/1070357/tmux-mouse-selection-resets-scrolling-position
unbind -T copy-mode MouseDragEnd1Pane
if-shell 'uname | grep -q Linux' {
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection
bind -T copy-mode-vi r send-keys -X rectangle-toggle
# Copy into the clipboard via xclip
# https://unix.stackexchange.com/a/349020
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i"
}
if-shell 'uname | grep -q Darwin' {
# https://dev.to/cseeman/how-to-copy-text-from-one-pane-macostmuxalacritty-2ll0
bind -T copy-mode-vi v send-keys -X begin-selection
# bind y key in copy mode to select and copy to system clipboard
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
}
# IBM1970 dark color theme
set -g mode-style bg=#006b6b,fg=#dddccc
set -g pane-active-border-style bg=#9c9977,fg=#9c9977
set -g pane-border-style bg=#423f2e,fg=#9c9977
set -g status-style bg=#9c9977,fg=#373424
set -g window-status-activity-style bg=#33a999,fg=#373424
set -g window-status-bell-style bg=#EE66BB,fg=#373424
set -g window-status-current-style bg=#423f2e,fg=#dddccc