Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid or unknown command: `bind-key -t vi-copy ....` #754

Closed
kevinushey opened this issue Feb 1, 2017 · 14 comments
Closed

invalid or unknown command: `bind-key -t vi-copy ....` #754

kevinushey opened this issue Feb 1, 2017 · 14 comments

Comments

@kevinushey
Copy link

@kevinushey kevinushey commented Feb 1, 2017

It looks like my attempts to bind keys in my .tmux.conf with vi-copy are now failing:

/Users/kevin/.tmux.conf:25: invalid or unknown command: bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
/Users/kevin/.tmux.conf:26: invalid or unknown command: bind-key -t vi-copy v begin-selection
/Users/kevin/.tmux.conf:30: invalid or unknown command: bind-key -t vi-copy Y copy-end-of-line
/Users/kevin/.tmux.conf:31: invalid or unknown command: bind-key -t vi-copy V rectangle-toggle
/Users/kevin/.tmux.conf:32: invalid or unknown command: bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
/Users/kevin/.tmux.conf.2:3: invalid or unknown command: bind-key -t vi-copy PPage page-up
/Users/kevin/.tmux.conf.2:4: invalid or unknown command: bind-key -t vi-copy NPage page-down

Is this expected with current tmux?

$ tmux -V
tmux master

Thanks!

@kevinushey
Copy link
Author

@kevinushey kevinushey commented Feb 1, 2017

Reading the updating man pages, it looks like this is intentional, and we must now write e.g.

bind-key -t vi-copy ...        # before
bind-key -T copy-mode-vi ...   # after

Are there any plans to support the old way of declaring copy-mode keybindings?

@nicm
Copy link
Member

@nicm nicm commented Feb 1, 2017

No this is how it is now.

@kevinushey
Copy link
Author

@kevinushey kevinushey commented Feb 1, 2017

Got it; thanks.

@kevinushey kevinushey closed this Feb 1, 2017
@timotheecour
Copy link

@timotheecour timotheecour commented Apr 23, 2017

@nicm
can this new syntax be backported to previous version of tmux? so that tmux.conf will work in either

@flowchartsman
Copy link

@flowchartsman flowchartsman commented Apr 26, 2017

Conversion how-to

For anyone who finds this for posterity, the full changes should be as follows:

Steps

  1. replace -t with -T
  2. replace vi-<name> with <name>-mode-vi
  3. prefix the command with send-keys -X

Brief Example

bind-key -t vi-copy v begin-selection

becomes

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

Longer Example

From my own tmux.conf:

Old Way

bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down
unbind-key -t vi-copy Space     ;   bind-key -t vi-copy v begin-selection
unbind-key -t vi-copy Enter     ;   bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
unbind-key -t vi-copy C-v       ;   bind-key -t vi-copy C-v rectangle-toggle
unbind-key -t vi-copy [         ;   bind-key -t vi-copy [ begin-selection
unbind-key -t vi-copy ]         ;   bind-key -t vi-copy ] copy-selection

New Way

bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down
unbind-key -T copy-mode-vi Space     ;   bind-key -T copy-mode-vi v send-keys -X begin-selection
unbind-key -T copy-mode-vi Enter     ;   bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
unbind-key -T copy-mode-vi C-v       ;   bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
unbind-key -T copy-mode-vi [         ;   bind-key -T copy-mode-vi [ send-keys -X begin-selection
unbind-key -T copy-mode-vi ]         ;   bind-key -T copy-mode-vi ] send-keys -X copy-selection
trautwein added a commit to trautwein/dotfiles that referenced this issue Apr 27, 2017
frankyjuang referenced this issue in frankyjuang/confJuang Apr 30, 2017
kogakure added a commit to kogakure/dotfiles that referenced this issue May 2, 2017
joshpencheon added a commit to joshpencheon/dotfiles that referenced this issue May 2, 2017
zackhsi added a commit to zackhsi/dotfiles that referenced this issue May 2, 2017
EvanPurkhiser added a commit to EvanPurkhiser/dots-personal that referenced this issue May 6, 2017
EvanPurkhiser added a commit to EvanPurkhiser/dots-personal that referenced this issue May 9, 2017
nhanb pushed a commit to nhanb/dotfiles that referenced this issue May 9, 2017
Latest tmux version has a breaking change:
tmux/tmux#754
brianfoshee added a commit to brianfoshee/dotfiles that referenced this issue May 10, 2017
Ran4 added a commit to Ran4/dotfiles that referenced this issue May 10, 2017
j-un pushed a commit to j-un/osx-provisioner that referenced this issue May 12, 2017
Reesi82 pushed a commit to Reesi82/dotfiles that referenced this issue May 12, 2017
Reesi82 pushed a commit to Reesi82/dotfiles that referenced this issue May 12, 2017
rjbernaldo added a commit to rjbernaldo/dotfiles that referenced this issue May 14, 2017
nhanb pushed a commit to nhanb/dotfiles that referenced this issue May 14, 2017
hale added a commit to hale/dotfiles that referenced this issue May 14, 2017
manishlad added a commit to manishlad/dotfiles that referenced this issue May 14, 2017
luugiathuy added a commit to luugiathuy/dotfiles that referenced this issue May 15, 2017
axelhodler pushed a commit to axelhodler/dotfiles that referenced this issue May 16, 2017
brianriley added a commit to brianriley/dotfiles that referenced this issue May 16, 2017
For details, see tmux/tmux#754
herenow added a commit to herenow/dotfiles that referenced this issue May 18, 2017
@exhuma
Copy link

@exhuma exhuma commented May 20, 2017

Hmm... I've got my config files synced via a git project. But not all machines have the same version of tmux installed. So I now have to decide where I want my bindings to work if I don't want to maintain two versions of my tmux.conf 😞

wbyoung added a commit to wbyoung/dotfiles that referenced this issue Apr 14, 2018
The current version installed is 2.7.

See also: tmux/tmux#754 (comment)
tpenguinltg added a commit to tpenguinltg/dotfiles that referenced this issue May 25, 2018
sharmaeklavya2 added a commit to sharmaeklavya2/dotfiles that referenced this issue Jun 27, 2018
keur added a commit to keur/dotfiles that referenced this issue Jul 9, 2018
In tmux version 2.4 some keybindings changed, including vi-style
copy and paste. Systems with older versions of tmux now
supported.

Idea taken from:
tmux/tmux#754
bryanburgers pushed a commit to bryanburgers/dotfiles that referenced this issue Jul 26, 2018
davidandreoletti added a commit to davidandreoletti/dotfiles that referenced this issue Aug 7, 2018
kenjyco added a commit to kenjyco/dotfiles that referenced this issue Oct 16, 2018
Also update setup.bash to use old config when system tmux version is
before v2.6

tmux/tmux#754
d10n added a commit to d10n/dotfiles that referenced this issue Jan 7, 2019
dailyherold added a commit to dailyherold/dotfiles that referenced this issue Feb 10, 2019
Updated the bindings to the new format thanks to this comment:
tmux/tmux#754 (comment)

However, when I "yank" selected text, it leaves some weird characters,
and still have to hit enter to get out of screen mode. So since I've
gotten used to just hitting enter, I'm going to disable the bindings
because I don't use them.
mparada added a commit to mparada/dot_files that referenced this issue Mar 4, 2019
patrickdavey added a commit to patrickdavey/dotfiles that referenced this issue Apr 12, 2019
Such a pain that they're always changing the damn syntax around!

see tmux/tmux#754 (comment)

Also, oddly, had to change from "copy-pipe" to "copy-pipe-and-cancel"
before it would work.
kai2nenobu added a commit to kai2nenobu/dotfiles that referenced this issue Jul 19, 2019
バージョン2.4でemacs-copyが無くなったり、コマンドの記述方法が変わったみたい。

ref. http://qiita.com/jyotti/items/5383d909f7307762fefa
ref. tmux/tmux#754 (comment)

上記を参考にして修正した。

1. -t を -T に変更する
2. emacs-copy を copy-mode に変更する
3. コマンドの先頭に send-keys -X を足す
kai2nenobu added a commit to kai2nenobu/dotfiles that referenced this issue Jul 19, 2019
環境によってtmuxのバージョンがぼちぼち違うので、バージョンで条件分岐する。
マイナーバージョンが1桁である前提なので、2.10とかになったら破綻する。

条件分岐の記法などは
tmux/tmux#754 (comment)
を見た。
kai2nenobu added a commit to kai2nenobu/dotfiles that referenced this issue Jul 19, 2019
環境によってtmuxのバージョンがぼちぼち違うので、バージョンで条件分岐する。
マイナーバージョンが1桁である前提なので、2.10とかになったら破綻する。

条件分岐の記法などは
tmux/tmux#754 (comment)
を見た。
agentreno added a commit to agentreno/dotfiles that referenced this issue Aug 5, 2019
tmux/tmux#754 describes the change of
configuration syntax, this fixes yank to system clipboard from copy
mode.
gtback added a commit to gtback/dotfiles that referenced this issue Sep 11, 2019
xiaoweihu pushed a commit to xiaoweihu/setup that referenced this issue Dec 21, 2019
@wookayin
Copy link

@wookayin wookayin commented Jan 31, 2020

Just for future reference: the version detection trick based on bc does not work with recent tmux's version strings such as 2.9a or 3.0a. I ended up doing like:

# @if "$TMUX_VERSION" >= 2.4
if-shell -b '[ "$(echo -e "$TMUX_VERSION\n"2.4 | sort -V | head -n1)" == "2.4" ]' \
   'bind -T copy-mode-vi "v" send-keys -X begin-selection; \
    bind -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel "pbcopy"; \
   '
wadells added a commit to wadells/.dotfiles that referenced this issue Feb 5, 2020
cioannid added a commit to cioannid/dotfiles that referenced this issue Feb 15, 2020
The current way to format the configuration for such commands is
explained here:
tmux/tmux#754 (comment)
selesse added a commit to selesse/dotfiles that referenced this issue Mar 4, 2020
@lock
Copy link

@lock lock bot commented Mar 11, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.