-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_tmux.conf
94 lines (74 loc) · 3.26 KB
/
dot_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
# Make sure to get terminfo working correctly!
# - tmux-256color is outdated on macOS: https://gist.github.com/bbqtd/a4ac060d6f6b9ea6fe3aabe735aa9d95
# - alacritty needs its own terminfo: https://github.com/alacritty/alacritty/blob/master/INSTALL.md#terminfo
#
# Note for alacritty: when installed via homebrew still needs a git checkout to install the terminfo mentioned above
# Note for tmux-256color: the link above breaks htop, this terminfo seems to work better:
# https://gist.github.com/nicm/ea9cf3c93f22e0246ec858122d9abea1
if-shell '[ "$TERMINAL_THEME" = light ]' \
{ source-file ~/.local/share/github-theme-contrib/tmux/github_light.conf } \
{ source-file ~/.local/share/nvim/lazy/tokyonight.nvim/extras/tmux/tokyonight_storm.tmux }
set -g default-terminal 'tmux-256color'
set-option -ga terminal-overrides ",xterm-256color:Tc,screen-256color:Tc,alacritty:Tc,xterm-kitty:Tc"
set-window-option -g xterm-keys on
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set-option -g allow-rename off
set-option -g mouse on
set-option -g renumber-windows on
# required for vim
set-option -g focus-events on
# enable clipboard for OSC-52
set -s set-clipboard on
bind -n C-t new-window -a
bind -n S-left prev
bind -n S-right next
bind -n C-left swap-window -d -t -1
bind -n C-right swap-window -d -t +1
# Pane splits
unbind %
unbind '"'
bind % split-window -h -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
# Lower ESC timeout (confusing in combination with vim)
set -s escape-time 1
# Pane resize with Ctrl-Arrow
unbind C-left
unbind C-right
unbind C-up
unbind C-down
bind -r C-left resize-pane -L
bind -r C-right resize-pane -R
bind -r C-up resize-pane -U
bind -r C-down resize-pane -D
bind h select-pane -L
bind j select-pane -U
bind k select-pane -D
bind l select-pane -R
bind -r C-h select-pane -L
bind -r C-j select-pane -U
bind -r C-k select-pane -D
bind -r C-l select-pane -R
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# vim-style copy mode
bind-key -Tcopy-mode-vi 'v' send -X begin-selection;
bind-key -Tcopy-mode-vi Escape send -X cancel;
bind-key -Tcopy-mode-vi V send -X rectangle-toggle
# Do not copy selection and cancel copy mode on drag end event
# Prefer iTerm style selection: select, then mouse click to copy to buffer
unbind -T copy-mode-vi MouseDragEnd1Pane
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "$HOME/.bin/tmux-yank.sh"
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "$HOME/.bin/tmux-yank.sh"
set -g @fingers-copy-command "$HOME/.bin/tmux-yank.sh"
# open new windows in previous working directory
bind c new-window -c "#{pane_current_path}"
# Session is considered to be remote when we ssh into host
if-shell 'test -n "$SSH_CLIENT"' 'source-file ~/.tmux.remote.conf'
# Session is considered to be local when not inside an ssh client
if-shell 'test -z "$SSH_CLIENT"' 'source-file ~/.tmux.local.conf'
# reattach-to-user-namespace
if -b "command -v reattach-to-user-namespace > /dev/null 2>&1" \
"run 'tmux set -g default-command \"exec $(tmux show -gv default-shell) 2>/dev/null & reattach-to-user-namespace -l $(tmux show -gv default-shell)\"'"
# if-shell 'test "$(uname)" = "Darwin"' 'source ~/.tmux.Darwin.conf'
# if-shell 'test "$(uname)" = "Linux"' 'source ~/.tmux.Linux.conf'