You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

129 lines
2.8 KiB

# load TMUX_VERSION
run-shell "\
echo #{version} | sed -e 's|\\.| |g' -e 's|[a-z]*$||' |\
while read x y; do\
tmux set-environment -g TMUX_VERSION \$((x * 100 + y));\
done"
# https://github.com/tmux/tmux/blob/master/CHANGES
#
# 2.9
# * individual -fg/-bg removed, use -style instead
# 2.4
# * vi-copy syntax changes
# 2.2
# * UTF8 autodetected, `set status-utf8` not accepted.
#
# same prefix as `screen`
set -g prefix C-a
unbind C-b
# 0-indexed is not keyboard friendly
set -g base-index 1
set -g pane-base-index 1
# misc features
set -s escape-time 1
setw -g mode-keys vi
# reload
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# send C-a
bind C-a send-prefix
# status bar
#
if-shell -b 'test $TMUX_VERSION -lt 202' 'set -g status-utf8 on'
set -g monitor-activity on
set -g visual-activity on
# Toggle mouse on with ^A m
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off with ^A M
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
# sessions
#
bind -r ( switch-client -p
bind -r ) switch-client -n
# windows
#
bind -r b select-window -t :-
bind -r n select-window -t :+
# panes
#
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# buffers
#
bind = paste-buffer
if-shell -b 'test $TEST_VERSION -lt 204' "\
bind -t vi-copy 'v' begin-selection; \
bind -t vi-copy 'y' copy-selection; \
"
if-shell -b 'test $TMUX_VERSION -ge 204' "\
bind-key -T copy-mode-vi v send -X begin-seletion; \
bind-key -T copy-mode-vi y send -X copy-seletion; \
"
# clear scroll
#
bind k send-keys -R \; clear-history
# http://stahlke.org/dan/tmux-nested/
set -g status-bg colour40
if-shell -b 'test $TMUX_VERSION -lt 209' 'setw -g window-status-current-bg colour40'
bind -n C-t new-window -a
bind -n S-left prev
bind -n S-right next
bind -n S-C-left swap-window -t -1
bind -n S-C-right swap-window -t +1
bind -n M-F11 set -qg status-bg colour25
bind -n M-F12 set -qg status-bg colour40
bind -n S-up \
send-keys M-F12 \; \
set -qg status-bg colour25 \; \
unbind -n S-left \; \
unbind -n S-right \; \
unbind -n S-C-left \; \
unbind -n S-C-right \; \
unbind -n C-t \; \
set -qg prefix C-b
bind -n S-down \
send-keys M-F11 \; \
set -qg status-bg colour40 \; \
bind -n S-left prev \; \
bind -n S-right next \; \
bind -n S-C-left swap-window -t -1 \; \
bind -n S-C-right swap-window -t +1 \; \
bind -n C-t new-window -a -c "#{pane_current_path}" \; \
set -qg prefix C-a