[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] zsh keybindings on remote redhat server
From: |
Greg Chicares |
Subject: |
Re: [lmi] zsh keybindings on remote redhat server |
Date: |
Thu, 13 Feb 2020 13:14:10 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
On 2020-02-13 00:37, Vadim Zeitlin wrote:
> On Wed, 12 Feb 2020 23:43:45 +0000 Greg Chicares <address@hidden> wrote:
>
> GC> On 2019-10-25 02:17, Greg Chicares wrote:
[...need explicit 'bindkey '\e[3~' delete-char' in ~/.zshrc ...]
> GC> Otherwise, when SSHing from a corporate laptop into a redhat server,
> GC> pressing Del...
> GC> - in viins mode: switches to vicmd mode
> GC> - in vicmd mode: changes the case of the character under the cursor
>
> I am not sure why does this happen,
SSHing into that server, without binding Del, I type:
jjjjjjjjj
^
and use the arrow keys to position the cursor at the fifth of nine characters,
then press Del. Result:
jjjJJJjjj
The reason is that transmitting '\e[3~' has this effect:
'\e' enters vicmd mode
'[' is consumed with no effect
(it sets context for an ensuing command like '%', but
here no ensuing command uses that context)
'3' repeats the ensuing command three times
'~' changes case
so the case of three successive characters is changed.
This behavior actually is logical. When zle receives this escape sequence...
- first, it checks for a keybinding; finding none,
- then it feeds the escape sequence to its vicmd parser,
and in this case the sequence just happens to be interpretable as a series
of vi commands.
The same outcome is observed if I explicitly hit these keys:
Esc, [, 3, ~
In zsh's default 'emacs' mode, I would have seen something like '^[[3~'
echoed onto the screen, which I would sooner have recognized as the
absence of a naively assumed keybinding.
> but there are basically 2 variables
> here: the terminal and the terminfo database. And infocmp command should
> give you the information about both, as it shows the current terminal and
> "kdch1" capability value (which corresponds to the Del key). So it should
> be possible to debug this by comparing its output in the various cases.
Thanks. I wrote the output of infocmp to a file, transferred it to my
real computer, and did
git diff --no-index ~/Downloads/infocmp.redhat =(infocmp)
which shows that the files are largely identical. Developing that
command was interesting in itself, because
git diff --no-index ~/Downloads/infocmp.redhat <(infocmp)
did not do what I wanted. I started to dig into the reasons why, but
the lesson I'll retain is that =() works more robustly than the
<() and >() forms of process substitution.
For now at least, I think I've made the server usable enough, but I'll
keep infocmp in mind if I encounter another troubling behavior. I do
notice this difference:
-kbs=\177
+kbs=^?
which seems to shed some light a concurrent change I'm making to
.zshrc in order to make Backspace work the same on both machines.