-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.tmux.conf
102 lines (78 loc) · 4.11 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
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 10
unbind C-b
set-option -g prefix C-Space
# https://github.com/sxyazi/yazi/wiki/Image-preview-within-tmux
set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
# increase scrollback buffer size
set -g history-limit 50000
# tmux messages are displayed for 4 seconds
set -g display-time 4000
# refresh 'status-left' and 'status-right' more often
set -g status-interval 5
# upgrade $TERM
# this will inherit TERM and set it to kitty-xterm to get italic fonts
# https://www.reddit.com/r/tmux/comments/pt5sxb/tmux_neovim_and_strikethrough_text_how/hduq6ft/?utm_source=share&utm_medium=web2x&context=3
set -g default-terminal "${TERM}"
set -ga terminal-overrides ",xterm-kitty:Tc,*-256color:Tc"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours
# emacs key bindings in tmux command prompt (prefix + :) are better than
# vi keys, even for vim users
set -g status-keys emacs
# 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
set-window-option -g mode-keys vi
# Start non-login shell, because login shell somehow is screwing up direnv.
# The downside is that .zlogin/.zprofile isn't sourced on new window, but that is ok since tmux session is started from a login shell and it inherits the environment.
# https://github.com/direnv/direnv/issues/106
set-option -g default-command "exec /bin/zsh"
# Setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-pipe "xclip"
set-option -g base-index 1
unbind-key L
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r H resize-pane -L 5
bind-key -r L resize-pane -R 5
set -g status-left "[#S] "
set -g status-right ""
if-shell 'test "$(uname)" = "Darwin"' 'source ~/.tmux-osx.conf'
# required! https://github.com/direnv/direnv/wiki/Tmux
# set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES"
# set-environment -gu DIRENV_DIFF
# set-environment -gu DIRENV_DIR
# set-environment -gu DIRENV_WATCHES
# set-environment -gu DIRENV_LAYOUT
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
bind-key -n 'C-h' run "($is_vim && tmux send-keys C-h) || tmux select-pane -L"
bind-key -n 'C-j' run "($is_vim && tmux send-keys C-j) || ($is_fzf && tmux send-keys C-j) || tmux select-pane -D"
bind-key -n 'C-k' run "($is_vim && tmux send-keys C-k) || ($is_fzf && tmux send-keys C-k) || tmux select-pane -U"
bind-key -n 'C-l' run "($is_vim && tmux send-keys C-l) || tmux select-pane -R"
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
set -g @plugin 'tmux-plugins/tpm'
# set -g @plugin 'tmux-plugins/tmux-copycat'
# set -g @plugin 'artemave/tmux-onedark-theme'
# set -g @plugin 'Morantron/tmux-fingers'
set -g @plugin 'artemave/tmux_super_fingers'
# run-shell ~/projects/tmux_super_fingers/tmux_super_fingers.tmux
set -g @plugin 'artemave/tmux_capture_last_command_output'
set -g @command-capture-key t
set -g @command-capture-prompt-pattern '^❯ '
# run-shell ~/projects/tmux_capture_last_command_output_2/tmux_capture_last_command_output.tmux
run -b '~/.tmux/plugins/tpm/tpm'