-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
executable file
·118 lines (94 loc) · 4.08 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# {{{1 check tmux version
# from https://stackoverflow.com/questions/35016458/how-to-write-if-statement-in-tmux-conf-to-set-different-options-for-different-t
run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | \
sed -En "s/^tmux[^0-9]*([.0-9]+).*/\1/p")'
# {{{1 common
setw -g mode-keys vi
set -g base-index 1 # pane number starts from 1
# set 256-color terminals
set -g default-terminal "tmux-256color"
# set -as terminal-overrides ',*:smulx=\E[4:%p1%dm'
# True Color support
set-option -ga terminal-overrides ",xterm-*:Tc:sitm=\e[3m:ritm=\e[25m" # italic support
if-shell -b '[ "$(echo "$TMUX_VERSION >= 3.2" | bc)" = 1 ]' \
'set -as terminal-features ",*:RGB"'
# set -as terminal-overrides ',*:smuc=\E[4:3m'
# Undercurl from https://github.com/monsonjeremy/onedark.nvim
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
set -g history-limit 10000
# https://github.com/neovim/neovim/wiki/FAQ
# Reduce delay of ESC in neovim
set -sg escape-time 10
# focus event
set-option -g focus-events on
# {{{1 key bindings
# change prefix
unbind C-b
unbind l
set -g prefix C-f
# Reload tmux config
bind-key -r C-c "source-file ~/.tmux.conf; display-message 'reload tmux config'"
bind-key -r h select-pane -L
bind-key -r j select-pane -D
bind-key -r k select-pane -U
bind-key -r l select-pane -R
bind-key -r H resize-pane -L 10
bind-key -r J resize-pane -D 10
bind-key -r K resize-pane -U 10
bind-key -r L resize-pane -R 10
# Use Alt-vim keys without prefix key to switch panes
# bind -n M-h select-pane -L
# bind -n M-j select-pane -D
# bind -n M-k select-pane -U
# bind -n M-l select-pane -R
bind-key -r f command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key -r t command-prompt -p "send pane to:" "join-pane -t '%%'"
bind-key v split-window -h
bind-key s split-window -v
# set tmux cwd to pane's cwd
# https://stackoverflow.com/questions/27307815/how-to-change-the-starting-directory-of-a-tmux-session
bind-key -r C-u "attach-session -t . -c '#{pane_current_path}'; display-message 'update tmux session cwd'"
# fzf session, from tmux-fzf plugin
bind-key -r s run-shell -b "~/.tmux/plugins/tmux-fzf/scripts/session.sh switch"
bind-key -r w run-shell -b "~/.tmux/plugins/tmux-fzf/scripts/window.sh switch"
bind-key -r b run-shell -b "~/.tmux/plugins/tmux-fzf/scripts/clipboard.sh buffer"
bind-key -r C run-shell -b "~/.tmux/plugins/tmux-fzf/scripts/command.sh"
bind-key -r S choose-session
bind-key -r W choose-window
# {{{2 copy-mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
# bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xsel -i -p -b'
bind-key -T prefix P paste-buffer
bind-key -T prefix p run "xsel -o | tmux load-buffer - ; tmux paste-buffer"
# {{{1 design changes
# loud or quiet?
# open window activity alert
set-option -g visual-activity on
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off # update pane color(reverse fg and bg)
set-option -g bell-action none
# set -g default-shell /usr/local/bin/fish
# {{{1 import configs
# import color theme
source ~/.tmux/onedark.conf
# vim-tmux-navigator
source ~/.tmux/vim-tmux-navigator.conf
# other custom configure
if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
# {{{1 plugins
# tmux plugin manager https://github.com/tmux-plugins/tpm
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'sainnhe/tmux-fzf'
setenv -g TMUX_FZF_OPTIONS "-p -w 80% -h 90%"
set -g @plugin 'tmux-plugins/tmux-yank' # yank to system clipboard
set -g @resurrect-processes 'v' # programs to be restored
set -g @plugin 'tmux-plugins/tmux-resurrect' # restore tmux after system reboot
# set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @plugin 'christoomey/vim-tmux-navigator'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'
# vim: set fdm=marker: