I have run into this before, and I know it's a relatively simple fix, but it has been a few years and my Googling has not turned up the answer. I have my zsh history set up such that if I start typing a few letters and then press the 'up arrow' it will only show me history items which match the letters I have already typed. However, when I ssh from my Mac to a Linux machine (which has a different zsh setup), and then exit ssh, my 'up arrow' goes back one at a time, regardless of whether or not I have typed anything first. Can someone remind me how to fix this? Thanks! Tj
On 28 Jul 2020, at 06:37, TJ Luoma <luomat@gmail.com> wrote: > > I have run into this before, and I know it's a relatively simple fix, > but it has been a few years and my Googling has not turned up the > answer. > > I have my zsh history set up such that if I start typing a few letters > and then press the 'up arrow' it will only show me history items which > match the letters I have already typed. > > However, when I ssh from my Mac to a Linux machine (which has a > different zsh setup), and then exit ssh, my 'up arrow' goes back one > at a time, regardless of whether or not I have typed anything first. > > Can someone remind me how to fix this? Maybe this page? <https://coderwall.com/p/jpj_6q/zsh-better-history-searching-with-arrow-keys> -- ɹןʇnqן <mailto:lbutler@covisp.net> tel:+1.303.219.0564
On Tue, Jul 28, 2020 at 2:39 PM TJ Luoma <luomat@gmail.com> 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
You almost certainly have different zle widgets bound to different key
sequences that correspond to up-arrow-key in raw and application
modes.
There are several ways to fix this.
1. Use `bind -s` to translate application mode key sequences to raw
and then bind only raw sequences to widgets (or the other way around).
This is my favorite.
2. Bind all widgets twice if you want to bind them to arrow keys or home/end.
3. Hook zle-line-init and change terminal mode to application/raw.
This is the most error prone method of the three. It breaks whenever
terminal mode is changed by a widget (as opposed to by a command) and
when you use some zsh plugins.
Roman.
On Tue, Jul 28, 2020 at 10:43 AM Roman Perepelitsa
<roman.perepelitsa@gmail.com> wrote:
>
> On Tue, Jul 28, 2020 at 2:39 PM TJ Luoma <luomat@gmail.com> 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