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

Re: How can one get editable, completing *and* history retrieval read command?





On Thu, Sep 11, 2008 at 10:44 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
On Sep 11,  7:42am, Rocky Bernstein wrote:
}
} I see there is both "vared" and "read" and "vared" would work if it
} handled history retrieval like an interactive prompt does. Also,
} I would need a way to determine if a given file descriptor is
} interactive or not. (This last aspect I have a feeling I can figure
} out some way, although perhaps not the best way).

I think you want "vared -h ..." ?

Yep. Thanks!

A change to zshdb's command reading now has this on github (and the -e mentioned below). I still have some work to integrate better with the history but that will come later.
 


    If the -p flag is given, the following string will be taken as the
    prompt to display at the left.  If the -r flag is given, the
    following string gives the prompt to display at the right.  If the
    -h flag is specified, the history can be accessed from ZLE. If the
    -e flag is given, typing ^D (Control-D) on an empty line causes
    vared to exit immediately with a non-zero return value.

You can combine this with "fc -p"/"fc -P" to use a different history in
vared.  See Functions/Misc/sticky-note for an example.

As for whether a descriptor is "interactive", probably the closest you
can get is "[[ -t 0 ]]" (replace 0 with the fd you're interested in).

I was right - what I had worked out on my own this isn't as robust, simple or elegant as this solution. Thanks again.



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