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

Re: up-arrow for history 'broken' after ssh



On 2020-07-28 17:48:55 -0700, Bart Schaefer wrote:
> On Tue, Jul 28, 2020 at 10:43 AM Roman Perepelitsa
> <roman.perepelitsa@xxxxxxxxx> wrote:
> >
> > On Tue, Jul 28, 2020 at 2:39 PM TJ Luoma <luomat@xxxxxxxxx> wrote:
> > >
> > > However, when I ssh from my Mac to a Linux machine [...]
> > > and then exit ssh, my 'up arrow' goes back one at a time
> >
> > There are several ways to fix this.
> 
> 4. (Assumes ssh starts a login shell) Change terminal mode back to raw
> in ~/.zlogout on the remote machine
> 5. Create a script to set as the ProxyCommand in your .ssh/config that
> resets the terminal mode after ssh exits

This won't work if the SSH session has to be disconnected from
the client (with ~.), e.g. after a network related issue.

I do all the cleanup in precmd(), e.g.

[[ -n $TTY && -n $terminfo ]] &&
  { echoti rmacs; echoti sgr0; echoti cnorm } > /dev/tty 2> /dev/null

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


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