I redirected stderr as Chris suggested (great pointer by the way) with:

bind-key -n C-y run "exec 2>&1 ; xclip -o | tmux load-buffer - ; tmux
paste-buffer"

and when I try to paste with C-y I get the following:

sh: tmux: command not found
sh: tmux: command not found
'exec 2>&1 ; xclip -o | tmux load-buffer - ; tmux paste-buffer'

This is odd, since tmux is definitely in $PATH.

$ which tmux
/home/james/local/bin/tmux

and, even if I drop manually into sh, I can still see tmux:

$ sh
> which tmux
> /home/james/local/bin/tmux

Why doesn't it see tmux?

James




On Wed, Apr 24, 2013 at 3:11 PM, Ashwin G <tuxdude.git...@gmail.com> wrote:

> I had a similar issue with xclip and tmux 1.8. I did not try xclip with
> previous versions of tmux, so not really sure if it was working with the
> older tmux versions.
>
> I think the problem is that xclip does not recognize that the input is
> from stdin and waits indefinitely, causing tmux to hang as well and tmux
> gives up after some time I think (or you could do detach and attach back
> too to kill xclip immediately).
>
> Although this is not a solution, I started using xsel instead of xclip and
> that seems to work reliably.
>
> These are my key bindings using xsel if you're interested:
>
> # Copy into clipboard
> bind C-c choose-buffer "run \"tmux save-buffer -b '%%' - | xsel -i -b\""
> # Paste from clipboard
> bind C-v run "xsel -o -b | tmux load-buffer - && tmux paste-buffer"
> # Copy into primary
> bind C-y choose-buffer "run \"tmux save-buffer -b '%%' - | xsel -i\""
> # Paste from primary
> bind C-p run "xsel -o | tmux load-buffer - && tmux paste-buffer"
>
> -Ashwin
>
>
>
>
> On Wed, Apr 24, 2013 at 12:04 PM, Chris Johnsen 
> <chris_john...@pobox.com>wrote:
>
>> On Wed, Apr 24, 2013 at 11:00 AM, James Jong <ribonucle...@gmail.com>
>> wrote:
>> > The following worked in Tmux 1.7 for pasting text in tmux, but not in
>> Tmux
>> > 1.8
>> >
>> > # Move x clipboard into tmux paste buffer
>> > bind-key -n C-y run "xclip -o | tmux load-buffer - ; tmux paste-buffer"
>> >
>> > But I now get the following in the status pane:
>> > xclip -o | tmux load-buffer - ; tmux paste-buffer exited with 127
>> >
>> > even though I can run xclip -o from the terminal (which correctly
>> pastes my
>> > text)
>> >
>> > Any thoughts why?
>>
>> Does it help if you redirect stdin from /dev/null? I.e.
>>
>>     bind-key -n C-y run "exec </dev/null ; xclip -o | tmux load-buffer
>> - ; tmux paste-buffer"
>>
>> It seems unlikely that "xclip -o" should be reading from stdin, but
>> run-shell (and if-shell) processes do get a different kind of stdin in
>> 1.8. Also, a bug I introduced in 1.8 leaves run-shell (and if-shell)
>> proceses with an open, but non-responsive stdin (previously it was
>> always /dev/null).
>>
>> If that works and you are comfortable building tmux form source, then
>> you might also try using your original command (no /dev/null redirect)
>> with a build from the SourceForge master branch; it has a fix that
>> should prevent the non-responsive stdin problem for run-shell (and
>> if-shell) processes.
>>
>> If none of that helps, you might try temporarily capturing stderr (it
>> is usually /dev/null) to see if there are any useful error messages to
>> go with the 127 exit:
>>
>>     bind-key -n C-y run "exec 2>&1 ; xclip -o | tmux load-buffer - ;
>> tmux paste-buffer"
>>
>> --
>> Chris
>>
>>
>> ------------------------------------------------------------------------------
>> Try New Relic Now & We'll Send You this Cool Shirt
>> New Relic is the only SaaS-based application performance monitoring
>> service
>> that delivers powerful full stack analytics. Optimize and monitor your
>> browser, app, & servers with just a few lines of code. Try New Relic
>> and get this awesome Nerd Life shirt!
>> http://p.sf.net/sfu/newrelic_d2d_apr
>> _______________________________________________
>> tmux-users mailing list
>> tmux-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/tmux-users
>>
>
>
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to