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

vared history not working inside scripts



On the command line, "vared -h" allows me to access history using arrow
keys or Control-R.
Inside a script, nothing happens. Is there some setting I have to make in
scripts. Here is an example:

    #!/usr/bin/env zsh

    export HISTFILE=~/.zhistory

    print "HIST: " $HISTFILE

    bindkey "^R" history-incremental-search-backward

    bindkey "^[[5~" up-line-or-history

    bindkey "^[[6~" down-line-or-history

    bindkey "^[[A" up-line-or-history

    bindkey "^[[B" down-line-or-history

    bindkey "OA"  up-line-or-history
    foo="default text"

    vared -h -p "Enter :" foo

(I have tried putting commands prior to the vared so some history is built
up in the program, or putting two vared calls, but in no case is history
called or available. ) After putting the key bindings into the script,
control-R prompts for backward search but there's only one item in history
which is the value of foo. That is perhaps why the up arrow does nothing.

How can i get some history for the user to choose from ?    I'd of course
prefer that if the user selected this option several times during the
running of the program, that i could build up the history for this variable
-- but most importantly I'd like to know what I am missing here due to
which I get no history.

 (I use OSX ML, latest zsh from homebrew 5.0.2 and zprezto).


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