-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
115 lines (93 loc) · 3.9 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
# Automatic install of TPM
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Set history size to 50000 lines
set -g history-limit 50000
set-option -g focus-events on
set -g set-titles on
set -g set-titles-string "#S / #W"
# Base tab index
set -g base-index 1
set -s escape-time 0
setw -g aggressive-resize on
# Automatically rename tmux window based on current pane path
set-option -g status-interval 1
set-option -g automatic-rename on
set-option -g automatic-rename-format "#{pane_current_command} / #{b:pane_current_path}"
# Change prefix to C-a
set-option -g prefix C-a
# Synchronize keyboard input across all panes
bind C-Y set-window-option synchronize-panes
# Default to 256color terminal
set -g default-terminal "tmux-256color"
set -sa terminal-features ",foot-extra:RGB"
# Set opening new panes in the same path
# as the one we are coming from
bind c new-window -c "#{pane_current_path}"
bind 'w' split-window -v -c "#{pane_current_path}"
bind 'v' split-window -h -c "#{pane_current_path}"
# Set mouse mode on
set -g mouse on
bind-key -r i run-shell "tmux neww tmux-cht.sh"
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
# switch windows alt+number
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
set-option -g detach-on-destroy off
bind -n M-s command-prompt -p "New Session:" "new-session -A -s '%%'"
bind -n M-d confirm kill-session
bind-key -n M-o display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_activity},#{session_name}}' |\
sort -r |\
sed '/^$/d' |\
cut -d',' -f2- \|
fzf --reverse --header jump-to-session --bind=shift-tab:up,tab:down --cycle --preview 'tmux capture-pane -pt {}' |\
xargs tmux switch-client -t"
# 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|n?vim?x?)(diff)?$'"
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' '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 'M-\\' if-shell \"$is_vim\" 'send-keys M-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys M-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'M-h' select-pane -L
bind-key -T copy-mode-vi 'M-j' select-pane -D
bind-key -T copy-mode-vi 'M-k' select-pane -U
bind-key -T copy-mode-vi 'M-l' select-pane -R
bind-key -T copy-mode-vi 'M-\' select-pane -l
bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r l resize-pane -R 5
bind -r h resize-pane -L 5
bind-key -T copy-mode-vi v send -X begin-selection
bind 'C-j' switch-client -n
bind 'C-k' switch-client -p
# TMUX PLUGINS
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-continuum \
tmux-plugins/tmux-yank \
wfxr/tmux-fzf-url \
'
run-shell '. ~/.tmux/papercolor-light.tmux'
# Tmux Resurrect content
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurect-processes 'nvim'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'