-
Notifications
You must be signed in to change notification settings - Fork 2
/
.tmux.conf.erb
107 lines (78 loc) · 4.33 KB
/
.tmux.conf.erb
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
# Start counting from 1, not 0, which is on the other side of the keyboard
set -g base-index 1
setw -g pane-base-index 1
# Always increment window number by one, even after closing a window
set -g renumber-windows on
# Improve interactivity
set -g mouse on
setw -g mode-keys vi
# Configure additional variables to update on session attachment
run-shell ~/.tmux/env.tmux
# Configure my status bar, color scheme, and prefix based on TERM
run-shell ~/.tmux/theme.tmux
# Define simple way to run my 't' command
# (this overrides the stupid clock keybinding)
bind-key t command-prompt -I 't ' "run-shell '~/bin/%%'"
# Shortcut to detach all other clients attached to this session
bind-key M-d detach-client -a
# Shortcut to kill all other windows than the current one
bind-key M-& confirm-before -p 'kill other windows? (y/n)' 'kill-window -a'
# Shortcut to toggle synchronized panes
bind-key S set-window-option synchronize-panes
# Send keys to initialize my home directory on non-AFS RHEL systems
bind-key I confirm-before -p 'initialize home directory? (y/n)' "send-keys 'if grep -q 8\\. /etc/redhat-release; then branch=rhel8-noafs; elif grep -q 7\\. /etc/redhat-release; then branch=rhel7-noafs; else branch=preprocessed; fi && cd && rm -rf .git && git init && git remote add origin https://gitlab.umd.edu/jtl/dotfiles.git && git fetch --depth=1 && git reset --hard \"origin/\${branch}\" && git checkout \"\$branch\" && exec \$SHELL' Enter"
# Send keys to reload vim when TERM changes
bind-key V confirm-before -p 'reload vim? (y/n)' 'run-shell ~/.tmux/reload-vim.tmux'
# Send keys for compatibility with hosts that do not contain my terminfo files
bind-key X run-shell ~/.tmux/term-compat.tmux
bind-key v run-shell ~/.tmux/term-compat.tmux
# Acknowledge alerts
bind-key @ kill-session -C
# Let middle click paste from primary selection
bind-key -T root MouseDown2Pane select-pane -t = \; if-shell -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" "send -M" "run-shell ~/.tmux/paste-primary.tmux"
# Enable primary selection clipboard using xterm OSC escape sequence
set -s set-clipboard on
set -s terminal-overrides 'rxvt-unicode*:Ms=\E]52;%p1%s;%p2%s\007,tmux*:Ms=\E]52;%p1%s;%p2%s\007'
# Alacritty and Foot use system clipboard by default
# Force primary clipboard
set -sa terminal-overrides ',alacritty*:Ms=\E]52;p%p1%s;%p2%s\007,foot*:Ms=\E]52;p%p1%s;%p2%s\007'
# Enable real truecolor when the TERM indicates support
set -sa terminal-overrides ',*truecolor*:Tc'
# Reload this config on attach
set-hook -g client-session-changed 'source-file ~/.tmux.conf'
#
# Plugins
#
# Improved wheel scrolling
# https://github.com/NHDaly/tmux-better-mouse-mode
set -g @scroll-without-changing-pane on
set -g @emulate-scroll-for-no-mouse-alternate-buffer on
run-shell ~/.tmux/plugins/tmux-better-mouse-mode/scroll_copy_mode.tmux
# Easy logging and screen capturing
# https://github.com/tmux-plugins/tmux-logging
run-shell ~/.tmux/plugins/tmux-logging/logging.tmux
# Improved bindings for controlling panes
# https://github.com/tmux-plugins/tmux-pain-control
run-shell ~/.tmux/plugins/tmux-pain-control/pain_control.tmux
# Enable copying to system clipboard
# https://github.com/tmux-plugins/tmux-yank
set -g @override_copy_command '~/bin/clip'
set -g @yank_with_mouse off
run-shell ~/.tmux/plugins/tmux-yank/yank.tmux
# Really cool enhanced search (with a bunch of pre-defined regexes)
# Modifies keybindings from tmux-yank so it needs to come after.
# https://github.com/tmux-plugins/tmux-copycat
run-shell ~/.tmux/plugins/tmux-copycat/copycat.tmux
# Sensible defaults (does not change anything already set above)
# https://github.com/tmux-plugins/tmux-sensible
run-shell ~/.tmux/plugins/tmux-sensible/sensible.tmux
# Override prefix c to prompt for a new window's name. If the prompt response
# is empty, fall back to the default automatic window naming. This is
# performed last to override some settings from the tmux-pain-control plugin.
bind-key c command-prompt -p '(new-window)' "run-shell \"$HOME/.tmux/new-window.tmux -c '#{pane_current_path}' -n '%%'\""
# Override prefix , to enable automatic renaming when an empty name is supplied
bind-key , command-prompt -p '(rename-window)' -I '#W' "run-shell \"$HOME/.tmux/rename-window.tmux '%%'\""
# Override swap-window keybindings to ensure the target is not selected
bind-key -r < swap-window -d -t -1
bind-key -r > swap-window -d -t +1
# vim: filetype=tmux