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

Re: zle separability

Frederik Eaton wrote:
> So 'vared' has history? How do I enable it?

(I moved this from workers to users since it's entirely about existing

Use the option -h to pick up the normal command history.  It doesn't
save the value, you have to use "print -s" for that.

Picking up a special history requires a little more work, but see the
function zcalc in the distribution which uses a push/pop mechanism for
the history added by Wayne.  You need 4.2.about1orso.

A simple wrapper around vared works:

varedhist() {
  history -ap ~/.vared_history
  vared -h "$@" || return 1
  print -s -- ${(P)argv[-1]}

This works like "vared -h" but uses ~/.vared_history as the history file
and saves new values to it.  The file behaves exactly like any other
history file, respecting all the usual options.  You can set them
locally in varedhist if you like.

Obviously, lots of extensions are possible.  You could make a special
variable history directory and keep a separate history for each
variable, for example, or add an argument to use a specified history file.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.


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