Tmux version specific vim bindings

This commit is contained in:
Sonny Bakker 2017-12-08 19:21:32 +01:00
parent 52f66b5de1
commit 673f7009c8
7 changed files with 640 additions and 5 deletions

View file

@ -1,12 +1,22 @@
# use vim copy/paste keybindings
setw -g mode-keys vi
# needs tmux 2.4
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'V' send -X select-line
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
# needs xclip for system clipboard
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "xclip -in -selection clipboard"
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6-)"
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.4" | bc)" = 1 ]' \
"bind-key Escape copy-mode; \
bind-key -t vi-copy Escape cancel; \
bind-key p paste-buffer; \
bind-key -t vi-copy v begin-selection; \
bind-key -t vi-copy V select-line; \
bind-key -t vi-copy r rectangle-toggle; \
bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard'"
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' \
"bind-key -T copy-mode-vi 'v' send -X begin-selection; \
bind-key -T copy-mode-vi 'V' send -X select-line; \
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle; \
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'"
# split panes using | and -
bind | split-window -h