jebaum/vim-tmuxify

:TxSend(@m) failing on tmux 1.6

mattboehm opened this issue · 4 comments

Calling :TxSend("foo") results in the following system call:

tmux send-keys -t 1 -l 'foo' && tmux send-keys -t '. pane_num .' C-m'

The :TxSend fails silently, but by running this command in a shell, I see the error:

tmux: unknown option -- l

I'm running tmux 1.6 on ubuntu 12.04. I suspect that this is a bug/invalid flag for this version of tmux.

A few suggestions:

  • look for a workaround or add a minimum required version number for tmux in the docs
  • commands shouldn't fail silently

I'm happy to take a stab at this but wanted your feedback first.

FWIW:

  • removing -l makes it work on my box
  • the system() call returns an empty string if it works and otherwise the aforementioned error message from tmux.

Because when not using the -l flag, tmux would interpret certain input differently (like interpreting keys instead of just dumping them to the terminal), and that's why that input has to be taken literally opposed to the second call of send-keys, because we actually want to interpret C-m here.

EDIT:

I'm at 1.9 right now, but this patch was introduced ~20 commits after 1.6 was tagged:

commit 94e46dd72468d364bb395603cf7fc9ae594ebd41
Author: Tiago Cunha <tcunha@gmx.com>
Date:   Thu Feb 2 02:01:18 2012 +0000

    Sync OpenBSD patchset 1025:

    Add -l flag to send-keys to send input literally (without translating
    key names). From Frank Terbeck.

I don't know how I would check for the correct version, because the output of tmux -V is quite inconsistent. I guess I should just add proper error handling to the plugin and issue an error message if tmux send-keys fails, like "You're suggested to update tmux to at least 1.7" or something.

I'd say at least stick it in the readme/doc and ideally if the output of that system call is non-empty, echoerr "Tmuxify error! Are you using tmux 1.7+?"

Okay, I did the changes!

BTW, I'm using tmux 1.7, but I also compile it myself.