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

Re: How to make underlining of a command line disappear after an ordinary key press? (2)



Hi Peter, 

So, this would be the best way to rebind the space bar as well: 

"""space-key-press(){
if [[ $KEYS = " " ]]; then
      zle rebind-spacebar
fi
zle .self-insert
}

zle -N self-insert space-key-press
"""

Thank you! 

Guido 

--- On Mon, 12/10/09, Peter Stephenson <pws@xxxxxxx> wrote:

> From: Peter Stephenson <pws@xxxxxxx>
> Subject: Re: How to make underlining of a command line disappear after an ordinary key press? (2)
> To: zsh-users@xxxxxxxxxx
> Date: Monday, 12 October, 2009, 4:03 PM
> Guido van Steen wrote:
> > ordinary-key-press(){
> >     if [[ $KEYS = [[:print:]] ]]; then
> >        
> region_highlight=("0 0 underline")
> >     fi
> >     zle .self-insert
> > }
> > 
> > zle -N .self-insert ordinary-key-press
> 
> You *don't* want the "." in the zle -N.  The whole
> point of the
> dot-commands is that they can't be replaced by user
> widgets.  That's
> the same reason you *do* want it in the function.
> 
>   ordinary-key-press(){
>       if [[ $KEYS = [[:print:]] ]];
> then
>          
> region_highlight=("0 0 underline")
>       fi
>       zle .self-insert
>   }
> 
>   zle -N self-insert ordinary-key-press
> 
> There's nothing special about space so long as it's bound
> to
> self-insert; I had no trouble using it.
> 
> By the way, if you ever need to undo this, the incantation
> is
> 
>   zle -A .self-insert self-insert
> 
> ---don't simply delete self-insert or you will have trouble
> typing.
> 
> -- 
> 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
> 


      New Email addresses available on Yahoo!
Get the Email name you&#39;ve always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/aa/



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