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

Re: fc in non-interactive shells and vared



Stephane Chazelas wrote:
>   - I could not use fc to load/save a history file as fc refuses
>     to work in non-interactive shells. Instead, I have to create
>     a history file manually, read it line by line and use print
>     -s to build the history stack.
> 
>     Is there a better way around that?

You can force a script to be run in interactive mode by including "-i"
in the options to the shell.  This may have side effects, however.

>   - When "vared" returns, zsh prints a NL character. As I'm on
>     the last line of the screen, this causes the screen to
>     scroll. Is there any way to avoid that? I tried to do a stty
>     onlret, but that doesn't work as vared resets the termios
>     settings.

I suspect this is coming from the trashzle() when ZLE exits.  This is
quite well buried.

I'm too lazy to try it, but if you have a sufficiently recent zsh you
could try something like

zle-line-init() { stty onlret; }
zle -N zle-line-init

before vared.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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