tmate-io/tmate

tmate fails with tmux 2.4 key bindings

m1foley opened this issue ยท 9 comments

On MacOS I have installed tmux 2.4 (brew install tmux) and tmate 2.2.1 (brew install tmate).

tmate starts up with an error:

/Users/mike/.tmux.conf:2: usage: send-keys [-lRM] [-t target-pane] key ...

My .tmux.conf binds keys in tmux 2.4 format:

bind-key -T copy-mode-vi 'v' send -X begin-selection

How do you advise using tmate with tmux 2.4? Is the only solution to downgrade tmux back to 2.3 (brew switch tmux 2.3_3; brew pin tmux)?

Homebrew moving to tmux 2.4 is messing up the entire tmux ecosystem. I guess it's time tmate had its own issue similar to the ones the tmux plugins are seeing.

ahh!
This means that tmate must be upgraded to the 2.4 version.
Will do it soon.

I made a ~/.tmate.conf file, which works well for now. Is there any way to tell tmate not to source ~/.tmux.conf?

sadly no, maybe that should be an option.

tmate -f /dev/null loads defaults for me. (any non-existent file should work though)

As a workaround, I have this in ~/.tmux.conf. It works with tmux 2.6 and tmate 2.2.1.

# Enable copying to clipboard from vi mode. Remap C-j for pane switching later.
# tmate is a fork of tmux 2.4, so it needs old keybindings.
# TODO: when tmate finally upgrades its tmux, remove this and
# `brew uninstall reattach-to-user-namespace`.
if-shell "pstree -p $$ | grep [t]mate" \
  'unbind c; bind c new-window -c "#{pane_current_path}"; \
  bind-key -t vi-copy v begin-selection; \
  bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"; \
  unbind -t vi-copy C-j; '\
  'bind -T copy-mode-vi v send -X begin-selection; \
  bind -T copy-mode-vi V send -X select-line; \
  bind -T copy-mode-vi C-v send -X rectangle-toggle \; send -X begin-selection; \
  bind -T copy-mode-vi y send -X copy-pipe-and-cancel pbcopy; \
  bind -T copy-mode-vi Escape send -X cancel; \
  unbind -T copy-mode-vi C-j;'

Because tmate didn't catch up with tmux, maybe the best thing to do for tmate is to not load the tmux configuration file by default?

hh commented

I'm on board with that.

can we update now please !!