tmux copy does not work

In case it helps, I had a correct tmux configuration (with vi like settings for selection & copy/paste) but needed to set these two environment variables in my .zshrc file (using Zsh & Neovim):

export EDITOR='nvim'
export VISUAL='nvim'

tmux has an option, mode-keys, you can find it in man page.

default is emacs, but if your $EDITOR is vim/vi, tmux will use vi.

So the key binding will be in vi mode.

E.g. your Alt-w won't work, it is emacs binding. you can see a table of key-binds in tmux man page.

some related to your question:

Function                     vi              emacs
Copy selection               Enter           M-w
Start selection              Space           C-Space

so you should go with the vi-mode keys.

I used vim mode too, and did a little customization (to make it same as vim) in my tmux.conf, maybe you could give it a try:

bind-key -t vi-copy 'v' begin-selection     # Begin selection in copy mode.
bind-key -t vi-copy 'C-v' rectangle-toggle  # Begin selection in copy mode.
bind-key -t vi-copy 'y' copy-selection      # Yank selection in copy mode.

Tags:

Shell

Tmux