Bart Schaefer wrote:
> > I can use suffix aliases to display various .txt files.
> > Can I do a similar thing for README files? So the "command"
> >
> > /some/path/README
> >
> > will really run the command
> >
> > less /some/path/README
>
> Depending on your version of zsh, you can do this either with the
> zle-line-finish widget or by replacing the accept-line widget.
>
> zle-line-finish() {
> setopt localoptions extendedglob
> if [[ -z "$PREBUFFER" && "$BUFFER" = ([^[:space:]]#/)#README ]]
> then BUFFER="less $BUFFER"
> fi
> }
> zle -N zle-line-finish
>
> Or
>
> accept-line() {
> setopt localoptions extendedglob
> if [[ -z "$PREBUFFER" && "$BUFFER" = ([^[:space:]]#/)#README ]]
> then BUFFER="less $BUFFER"
> fi
> zle .accept-line "$@"
> }
> zle -N accept-line
Is there any way to get either of these to work without changing the command
that is stored in history? So the history contains '/some/path/README' and not
'less /some/path/README'?
--
John Eikenberry
[ jae@xxxxxxxx - http://zhar.net ]
[ PGP public key @ http://zhar.net/jae_at_zhar_net.gpg ]
________________________________________________________________________
"Perfection is attained, not when no more can be added, but when no more
can be removed." -- Antoine de Saint-Exupery
Attachment:
signature.asc
Description: Digital signature