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

Re: How to read into variable with readline support?



On 01/16/2018 01:42 PM, Andy Spiegl wrote:
> I would like to read input from the keyboard (like "read $VAR") but
> with editing and history support.  I'm sure zsh offers this but I am
> too stupid to find out how.
> 
> Thanks!
>  Andy
> 

People normally use vared, which uses zle for line editing.

vared -c var

you can even change the completion used with it:

() {
  local compcontext='hosts:hostname:_hosts'
  vared -cp 'choose a host ' ans
}



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