[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-readline] key bindings proposal

From: frederik
Subject: Re: [Bug-readline] key bindings proposal
Date: Fri, 20 May 2016 11:25:19 -0700
User-agent: Mutt/1.6.1 (2016-04-27)

Hi Chet,

I got it.

Here's a discussion which is relevant: 

What I envisioned was a facility to execute external commands, not
alternate-keymap macros. This would be needed in order to get a
solution which applies to all readline applications, not just Bash. I
was thinking that in addition to normal ~/.inputrc bindings like

"\e[1;5C": forward-word

and macros like

"\ex": 'cd !$ \015ls\015'

Readline could also support some syntax like

"\C-x\C-w": `x-clip-kill-region`

This would bind the key sequence to a command in my path named
"x-clip-kill-region" (executed with system()) which is called with
READLINE_LINE and READLINE_POINT environment variables set (shouldn't
there also be a READLINE_MARK?).

It could update the value of these variables by outputting e.g.
"READLINE_POINT=...\0READLINE_LINE=...\0" on STDOUT (or whatever is
easiest to parse).



On Fri, May 20, 2016 at 08:38:27AM -0400, Chet Ramey wrote:
> On 5/19/16 11:34 PM, address@hidden wrote:
> > Hi Chet,
> > 
> > Thanks for explaining your views.
> > 
> > Bash has a facility which I believe is based on binding a key to a
> > string which is executed as if entered at the prompt, is that correct?
> > Or were you referring to something else?
> Yes, that's pretty much it.  You use the readline key binding syntax to
> bind a string to a key sequence using a separate keymap.  Then you bind
> that key sequence in the active keymap to a function that will look up
> the string in the alternate keymap and execute it as if run by `eval'.
> The READLINE_LINE and READLINE_POINT variables allow that command to
> modify the line.  It's not a perfect fit to what readline could provide
> `natively', but it's close.
> -- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]