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

Re: alias vl="vi !$"



Hi,

zzapper wrote:
> On Thu, 11 Mar 2004 12:33:55 +0000, Peter Stephenson  wrote:
> 
> On the command prompt line I'm often typing say
> 
> >ll fred.txt
> >vi !$
> 
> Now I'd like to have an alias/function called say vl (vi last)
> 
> >vl
> 
> Which would save me typing vi !$ (my poor little fingers!), for that
> to work vl would need to access the line history

accept-line-or-empty-cmd() {
    if [ "$LBUFFER$RBUFFER"  = vl ] ; then
        LBUFFER="vi !$"
        RBUFFER=""
    fi
    builtin zle .accept-line
}
zle -N accept-line-or-empty-cmd
bindkey "^M" accept-line-or-empty-cmd

Fun with widgets :)

Ciao,
Thomas

-- 
 Thomas Köhler       Email:       jean-luc@xxxxxxxxxxxxxxxxx
     <><             WWW:           http://jeanluc-picard.de
                     IRC:                           tkoehler
                     PGP public key available from Homepage!

Attachment: signature.asc
Description: Digital signature



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