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

Re: Suffix alias for README files



Reply to message «Re: Suffix alias for README files», 
sent 22:57:07 20 April 2011, Wednesday
by John Eikenberry:

> I'll play with this after work but I have a quick question. Do you know
> whether this would play nice with the hist_ignore_all_dups setting? My
> experiments with using print to manually add entries previously have not
> worked as they all failed to respect hist_ignore_all_dups.
I have histignorealldups set and everything works normally. But I remember I had 
some bad issues when I tried to implement it without using zshaddhistory hook: 
as far as I remember, `fc -p' call results were significantly different.

Original message:
> ZyX wrote:
> > Reply to message «Re: Suffix alias for README files»,
> > sent 21:25:43 20 April 2011, Wednesday
> > 
> > by John Eikenberry:
> > > 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'?
> > 
> > Yes, of course. I personally use the following code:
> >     function zshaddhistory()
> >     {
> >     
> >         emulate -L zsh
> >         if ! [[ -z "${_HISTLINE}" ]] ; then
> >         
> >             print -sr -- "${_HISTLINE}"
> >             unset _HISTLINE
> >         
> >         else
> >         
> >             print -sr -- "${1%%$'\n'}"
> >         
> >         fi
> >         fc -p
> >     
> >     }
> > 
> > With this function if you set variable _HISTLINE somewhere before
> > zshaddhistory hook is run then contents of _HISTLINE will be put into the
> > history. Widget accept-line is called before zshaddhistory.
> 
> I'll play with this after work but I have a quick question. Do you know
> whether this would play nice with the hist_ignore_all_dups setting? My
> experiments with using print to manually add entries previously have not
> worked as they all failed to respect hist_ignore_all_dups.
> 
> Thanks.

Attachment: signature.asc
Description: This is a digitally signed message part.



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