-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_tmux.conf
50 lines (43 loc) · 2.43 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
# Prefix shortcut is ctrl-a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
set -wg mode-keys vi
bind \\ split-window -h # Split panes horizontal
bind - split-window -v # Split panes vertically
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
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
# https://github.com/neovim/neovim/wiki/FAQ#esc-in-tmux-or-gnu-screen-is-delayed
# https://github.com/helix-editor/helix/wiki/Troubleshooting#when-using-tmux-or-screen-there-is-a-delay-after-hitting-escape-before-its-registered
set -sg escape-time 10
# per neovim :checkhealth suggestion
# https://github.com/neovim/neovim/wiki/FAQ#home-or-some-other-special-key-doesnt-work
# https://github.com/neovim/neovim/wiki/FAQ#colors-arent-displayed-correctly
#set -g default-terminal "tmux-256color"
# now needs to be:
#set-option -ga terminal-overrides ",xterm-256color:Tc" # https://stackoverflow.com/questions/60309665/neovim-colorscheme-does-not-look-right-when-using-nvim-inside-tmux#comment124479399_60313682
#set-option -g default-terminal "xterm-256color"
#set-option -sa terminal-features ",xterm-256color:RGB"
#set-option -ga terminal-overrides ',xterm-256color:Tc'
# - WARNING Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.
# - ADVICE:
# - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
# set-option -sa terminal-features ',XXX:RGB'
# - For older tmux versions use this instead:
# set-option -ga terminal-overrides ',XXX:Tc'
set -g default-terminal "screen-256color"
# https://www.freecodecamp.org/news/tmux-in-practice-integration-with-system-clipboard-bcd72c62ff7b/
# Mac:
#bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
# Linux:
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"