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. -- 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