-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
118 lines (92 loc) · 6.03 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
# ------------------------------------------------------------------------------
# https://github.com/tmux-plugins/tpm
set-option -g @plugin 'tmux-plugins/tpm'
# https://github.com/tmux-plugins/tmux-sensible
set-option -g @plugin 'tmux-plugins/tmux-sensible'
# https://github.com/tmux-plugins/tmux-yank
set-option -g @plugin 'tmux-plugins/tmux-yank'
# https://github.com/christoomey/vim-tmux-navigator
# set-option -g @plugin 'christoomey/vim-tmux-navigator'
# https://superuser.com/questions/209437/how-do-i-scroll-in-tmux
set-option -g @plugin 'nhdaly/tmux-better-mouse-mode'
# https://github.com/tmux-plugins/tmux-prefix-highlight
set-option -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# https://github.com/tmux-plugins/tmux-open
set-option -g @plugin 'tmux-plugins/tmux-open'
# https://github.com/tmux-plugins/tmux-resurrect
# ctrl+s save
# ctrl-r restore
set-option -g @plugin 'tmux-plugins/tmux-resurrect'
# https://github.com/Morantron/tmux-fingers
set -g @plugin 'Morantron/tmux-fingers'
# https://github.com/tmux-plugins/tpm/blob/master/docs/automatic_tpm_installation.md
run-shell '[ -d ~/.tmux/plugins/tpm ] || (git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins)'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run-shell -b '~/.tmux/plugins/tpm/tpm'
# ------------------------------------------------------------------------------
# https://github.com/NHDaly/tmux-better-mouse-mode
set-option -g mouse on
# nvim :checkhealth
set-option -sg escape-time 10
# XXX: https://github.com/tmux-plugins/tmux-sensible/blob/master/sensible.tmux#L107
set-option -g default-terminal "screen-256color"
set-option -sa terminal-overrides ',xterm-256color:RGB'
# Use vim keybindings in copy mode
set-option -w -g mode-keys vi
# XXX: https://github.com/salcode/ironcode-tmux/issues/25
# Setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi v send-keys -X begin-selection
if-shell '[ $(uname) = Darwin ]' 'bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"'
if-shell '[ $(uname) = Linux ]' 'bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"'
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
# Update default binding of `Enter` to also use copy-pipe
if-shell '[ $(uname) = Darwin ]' 'bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"'
# https://www.bugsnag.com/blog/tmux-and-vim
bind-key | split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
# enhanced vim-tmux-navigator
is_vim="echo '#{pane_current_command}' | grep -iqE 'g?(view|n?vim?x?)(diff)?$'"
is_fzf="echo '#{pane_current_command}' | grep -iqE 'fzf$'"
is_k9s="echo '#{pane_current_command}' | grep -iqE 'k9s$'"
bind-key -n C-h run-shell "($is_vim && tmux send-keys C-h) || tmux select-pane -L"
bind-key -n C-j run-shell "($is_fzf && tmux send-keys C-j) || tmux select-pane -D"
bind-key -n C-k run-shell "($is_vim && tmux send-keys C-k) || ($is_fzf && tmux send-keys C-k) || ($is_k9s && tmux send-keys C-k) || tmux select-pane -U"
bind-key -n C-l run-shell "($is_vim && tmux send-keys C-l) || tmux select-pane -R"
# https://unix.stackexchange.com/questions/35924/how-to-make-tmux-count-windows-starting-from-1-instead-of-0
set-option -g base-index 1
set-option -w -g pane-base-index 1
# https://unix.stackexchange.com/questions/136631/how-to-switch-directly-to-a-pane-in-tmux
set-option -g display-panes-time 4000
# https://superuser.com/questions/1440876/alacritty-tmux-cant-copy-big-portion-of-text-in-copy-mode/1440887
set-option -g set-clipboard off
# ------------------------------------------------------------------------------
# https://apple.stackexchange.com/questions/41412/using-tmux-and-pbpaste-pbcopy-and-launchctl
# assume pane 2 is always the pane that has a REPL - ammonite, ipython etc
bind-key C-v run-shell "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer -t 2 && tmux send-keys -t 2 Enter"
# ------------------------------------------------------------------------------
# This tmux statusbar config was created by tmuxline.vim
# :Tmuxline
# :TmuxlineSnapshot statusline.tmux
set-option -g status-justify "left"
set-option -g status "on"
set-option -g status-left-style "none"
set-option -g message-command-style "fg=colour231,bg=colour31"
set-option -g status-right-style "none"
set-option -g pane-active-border-style "fg=colour254"
set-option -g status-style "none,bg=colour234"
set-option -g message-style "fg=colour231,bg=colour31"
set-option -g pane-border-style "fg=colour240"
set-option -g status-right-length "100"
set-option -g status-left-length "100"
set-option -g -w window-status-activity-style "none"
set-option -g -w window-status-separator ""
set-option -g -w window-status-style "none,fg=colour250,bg=colour234"
set-option -g status-left "#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold,nounderscore,noitalics]"
set-option -g status-right "#[fg=colour236,bg=colour234,nobold,nounderscore,noitalics]#[fg=colour252]#[fg=colour235,bg=colour252] #(kubectl config current-context 2>/dev/null):#(kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)#[fg=colour247,bg=colour236] %Y-%m-%d %H:%M #[fg=colour252,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour235,bg=colour252] #h "
set-option -g -w window-status-format "#[fg=colour244,bg=colour234] #I #[fg=colour250,bg=colour234] #W "
set-option -g -w window-status-current-format "#[fg=colour234,bg=colour31,nobold,nounderscore,noitalics]#[fg=colour117,bg=colour31] #I #[fg=colour231,bg=colour31,bold] #W #[fg=colour31,bg=colour234,nobold,nounderscore,noitalics]"
# ------------------------------------------------------------------------------
# https://tmuxguide.readthedocs.io/en/latest/tmux/tmux.html
# http://man7.org/linux/man-pages/man1/tmux.1.html
# https://superuser.com/questions/758843/difference-between-global-server-session-and-window-options
# tmux show-options -g # show current value of options