2
votes

I have the following in my ~/.tmux.conf file

# improved (vi) copy paste
#
# vi mode in tmux
setw -g mode-keys vi
bind-key -t vi-copy y copy-selection
# select entire line
bind-key -t vi-copy v select line

Up till today this has always worked perfectly, problem is I've updated to the latest version :(.

tmux -V shows me that I'm currently at version 2.4

The vi-copy bindings are not working anymore. It seems that vi-copy mode is broken. If I execute the following:

CTRL+<leader> :list-keys -t vi-copy

The output is:

Unknown key-table vi-copy

According to this, it is a known issue

And you now have to do the following (extracted comment from the above link):

Basically you now need to bind your key in the copy-mode-vi table now, look at how the default key bindings are done with "tmux lsk". For your example: bind -Tcopy-mode-vi v send -X begin-selection

I'm sharing my tmux configuration across varous PC's, which are running different tmux versions, I hope somebody can explain how a cross compatible tmux configuration can be created, in which I can have the same keybindings and vi mode behaviour.

1

1 Answers

1
votes

I have the following snippet in my tmux.conf:

if-shell "tmux -V | awk '{exit($2<2.4?0:1)}'" \
    "bind-key -t vi-copy 'v' begin-selection; bind-key -t vi-copy 'y' copy-selection" \
    "bind-key -T copy-mode-vi 'v' send -X begin-selection; bind-key -T copy-mode-vi 'y' send -X copy-selection"

Not the prettiest code I wrote but it seems to work.