I *just* subscribed now, but I was wrestling with nearly the same problem
yesterday.  Here's my kludge of rebinding with unprefixed keys.

Hard to follow, I know, but the gist is that when entering copy mode it
rebinds y and Enter (unprefixed) to source scripts.  The scripts in turn do
actions and rebind other keys.  In order to execute copy-mode actions from
the global bindings, it rebinds the copy-mode actions to a temporary key T,
then send-keys T to execute the action.  I'm sure there are bugs in this if
there are ways to exit out of copy mode that I haven't considered.

I think the cleaner solution would be to allow the full command parser in
all the key tables, but this was easier than making that change to the
source.

.tmux.conf:
bind-key C-c source-file /home/disser/.tmux-copy-mode

/home/disser/.tmux-copy-mode:
bind-key -n y send-keys 0 \; source "/home/disser/.tmux-begin-selection" \;
send-keys "\$"
bind-key -n Enter source /home/disser/.tmux-begin-selection
bind-key -n q source /home/disser/.tmux-cancel-selection
copy-mode

/home/disser/.tmux-begin-selection:
bind-key -n y source /home/disser/.tmux-copy-selection
bind-key -n Enter source /home/disser/.tmux-copy-selection
bind-key -t vi-copy T begin-selection
send-keys T
unbind-key -t vi-copy T

/home/disser/.tmux-begin-selection:
unbind-key -n y
unbind-key -n Enter
unbind-key -n q
bind-key -t vi-copy T copy-selection
send-keys T
unbind-key -t vi-copy T

/home/disser/.tmux-cancel-selection:
unbind-key -n q
unbind-key -n Enter
unbind-key -n y
bind-key -t vi-copy T cancel
send-keys T
unbind-key -t vi-copy T




--------------------------------------------------------------------------------------
Original message:

With:
bind-key Y send-keys '^' Space '$' Enter
I can hit prefix + Y in copy-mode and get it to copy the line.

Not an optimal solution, but an acceptable workaround.

Of course now I remember that that sequence used to be repeatable (5Y to
copy 5 lines)...
that may be a bit trickier to recreate.
It might be easier to patch the source and add a copy-line command
instead...
i'll put that on my todo list. Â :-)

Thanks!

On Fri, Apr 22, 2011 at 11:53 PM, Micah Cowan <mi...@cowan.name> wrote:

> On 04/22/2011 05:26 PM, Randy Stauner wrote:
> > I first tried using send-keys (bind-key -t vi-copy send-keys ^ ' ' $
> Enter)
> > but send-keys isn't a valid command in copy-mode.
>
> Drop the -t vi-copy; you want to use a normal-map binding so you can use
> the normal-map command (of course, this means you'll need to hit the
> prefix before the bound key, or else use -n.
>
> --
> Micah J. Cowan
> http://micah.cowan.name/
>
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to