Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zle insert problems



On Tue, 2 Aug 2011 17:28:10 +0200
Pascal Wittmann <PascalWittmann@xxxxxxx> wrote:
> On 08/02/2011 05:09 PM, Jérémie Roquet wrote:
> > replace-pacman-command() {
> >   BUFFER=${BUFFER/pacman [-a-zA-Z]#/pacman $@}
> > }
> > 
> 
> Thanks, this is quite readable!
> 
> I'll take this solution but just to have a explicit no: There is no way
> doing this only via zle?

That's not really a meaningful question.  It's not possible to do it via
zle *commands*, no, but the whole point of having the zle variables is
some things are best done that way rather than by commands.  In other
words, what you were trying to do as a zle command to insert a string
at the cursor position is actually written as:

LBUFFER+="string"

This is still using zle; it's basically equivalent to the non-existent
command

zle insert-string "string"

but much more flexible.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog



Messages sorted by: Reverse Date, Date, Thread, Author