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

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



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