/
dot_tmux.conf.tmpl
136 lines (100 loc) · 4.53 KB
/
dot_tmux.conf.tmpl
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
# Core options (https://github.com/tmux-plugins/tmux-sensible)
#
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 50
# increase scrollback buffer size
set -g history-limit 50000
# tmux messages are displayed for 4 seconds
set -g display-time 4000
# screen-256 true color
set -g default-terminal "screen-256color"
set-option -sa terminal-overrides ",alacritty:Tc"
# focus events enabled for terminals that support them
set -g focus-events on
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# ===========================================================================
# Other options
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
set -g status on
# refresh 'status-left' and 'status-right' more often
set -g status-interval 5
set -g status-justify left
set -g status-position bottom
set -g status-keys vi
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
unbind-key C-b
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
set -g renumber-windows on # renumber windows when a window is closed
set -g set-titles on # set terminal title
set -g set-titles-string '❐ #S ● #I #W'
set -g display-panes-time 500 # slightly longer pane indicators display time
# Notifications
setw -g monitor-activity on
setw -g visual-activity on
# Auto rename
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b;s/{{ .username }}/~/:pane_current_path}'
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix
# Activity monitoring
setw -g monitor-activity on
set -g visual-activity on
# Split windows into panes: CTRL-A + h or v
bind-key h split-window -v -c '#{pane_current_path}'
bind-key v split-window -h -c '#{pane_current_path}'
# Set up resize-pane keys: ALT + left - right - down - up
bind-key -n M-Left resize-pane -L 1
bind-key -n M-Right resize-pane -R 1
bind-key -n M-Down resize-pane -D 1
bind-key -n M-Up resize-pane -U 1
# Switch windows: CTRL-ALT + left or right arrows
bind-key -n C-M-Left previous-window
bind-key -n C-M-Right next-window
set-window-option -g mode-keys vi
# -- copy mode -----------------------------------------------------------------
bind Enter copy-mode # enter copy mode
run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
# copy to Mac OSX clipboard
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b"'
# copy to Ms Windows clipboard
if -b '[ -c /dev/clipboard ]' 'bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "tmux save-buffer - > /dev/clipboard"'
# Move windows on the left (/) or on the right (*)
bind-key / swap-window -t -1
bind-key * swap-window -t +1
# define keystrokes to send favorite commands defined as env var
# ALT-SHIFT-<number>
bind-key M-1 send-keys "$FAVORITE_COMMAND1"
bind-key M-2 send-keys "$FAVORITE_COMMAND2"
bind-key M-3 send-keys "$FAVORITE_COMMAND3"
bind-key M-4 send-keys "$FAVORITE_COMMAND4"
# Reload tmux config
unbind r
bind r source-file ~/.tmux.conf \; display-message "config reloaded!"
# plugin last_command_output
set -g @command-capture-prompt-pattern '$ '
set -g @command-capture-editor-cmd 'gedit -'
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'laktak/extrakto'
set -g @plugin 'artemave/tmux_capture_last_command_output'
set -g @plugin "arcticicestudio/nord-tmux"
# run tpm
run -b '~/.tmux/plugins/tpm/tpm'
# =========================== END OF FILE ===================================