zsh-users
 help / color / mirror / code / Atom feed
From: rahul <rahul2012@gmail.com>
To: zsh-users@zsh.org
Subject: vared history not working inside scripts
Date: Sun, 13 Jan 2013 19:55:43 +0530	[thread overview]
Message-ID: <CACQNQ9NcJoXNHVePAKr9eW1HVtwN=4ZH9E__-yghPXXb_aWj_Q@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]

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

             reply	other threads:[~2013-01-13 14:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-13 14:25 rahul [this message]
2013-01-13 18:54 ` Bart Schaefer
2013-01-13 19:25   ` rahul
2013-01-14  9:37   ` Han Pingtian
2013-01-13 18:56 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACQNQ9NcJoXNHVePAKr9eW1HVtwN=4ZH9E__-yghPXXb_aWj_Q@mail.gmail.com' \
    --to=rahul2012@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).