-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux.conf
More file actions
117 lines (88 loc) · 3.55 KB
/
tmux.conf
File metadata and controls
117 lines (88 loc) · 3.55 KB
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
# remap prefix to C-g
set -g prefix 'C-g'
unbind 'C-b'
bind 'C-g' send-prefix
# start window and pane numbering at 1
set -g base-index 1
setw -g pane-base-index 1
# load statusline configs if the file exists
if-shell "test -f $DOTFILES_DIR/tmux-statusline.conf" "source $DOTFILES_DIR/tmux-statusline.conf"
# listen to alerts from all windows
set -g bell-action any
# vim movement bindings
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# and use C-h and C-l to cycle thru panes
bind -r 'C-h' select-window -t :-
bind -r 'C-l' select-window -t :+
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# set scrollback history to 10k
set -g history-limit 10000
# renumber windows when one is deleted
set-option -g renumber-windows on
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# sort sessions by name
bind s choose-tree -sZ -O name
set-option -g default-shell "/bin/zsh"
# Undercurl
set-option default-terminal "tmux-256color"
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
# for 256 color support
set -as terminal-features ",*256col*:RGB"
# copy mode config
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' "send-keys -X begin-selection"
bind -T copy-mode-vi 'y' "send-keys -X copy-selection"
# Added for nvim-tmux-navigation plugin
# Allows smart pane switching with awareness of vim splits
# -----
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(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'
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 -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+'
bind j send-keys C-j
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
bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+
# -----
# to allow "open" command from within tmux
if-shell 'test "$(uname)" = "Darwin"' 'source $HOME/dotfiles/tmux-osx.conf'
# open new panes and windows in current directory
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
bind space display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
sed '/^$/d' |\
fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' |\
xargs tmux switch-client -t"
# PLUGINS
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'laktak/extrakto'
# PLUGIN CONFIGS
set -g @continuum-restore 'on'
set -g @colors-solarized 'dark'
run -b '~/.tmux/plugins/tpm/tpm'