From: Paul Branon on
in the output of bind -P

what does

beginning-of-line can be found on "M-OH", "M-[H"



precisely which key sequences are these?
M-OH", "M-[H"
From: Alan Curry on
In article <f9f7c7df-0d18-4bc1-9096-2403b117849f(a)x25g2000yqj.googlegroups.com>,
Paul Branon <paulbranon(a)googlemail.com> wrote:
>in the output of bind -P

Apparently that's a bash command...

>
>what does
>
>beginning-of-line can be found on "M-OH", "M-[H"

Oh boy...

>
>precisely which key sequences are these?
>M-OH", "M-[H"

This is an example of a notation used only by emacs devotees, which vi
users don't normally need to know about. "C-" is short for "Ctrl-" and
"M-" is short for "Meta-", which really mostly means "Alt-" since
genuine Meta keys are hard to find.

So literally, "M-OH" means Alt-O followed by H. If you type that
sequence, you may find that it actually works, moving the cursor to
beginning-of-line. But that's not the intended usage.

The Alt key in a terminal has 2 common behaviors: either it sets the
high bit of the character (so the O is modified from ASCII code 0x4f to
0xcf) or it prefixes the character with an Escape (so Alt-O generates
0x1b 0x4f).

Thus "M-OH" can be translated into non-emacs-speak as one of these:
"^[OH"
"\033OH"
ESC O H

And "M-[H" is "^[[H"

Which is the escape sequence generated by the "Home" key, in many
terminal types.

If you want to get away from this weird influence of the church of emacs
(showing up even in the display of "vi mode" keybindings!), one way
would be to use zsh, which uses the more unix-normal "^[[H" style in the
equivalent bindkey command.

--
Alan Curry
From: Paul Branon on
On Aug 13, 12:52 am, pac...(a)kosh.dhis.org (Alan Curry) wrote:
> In article <f9f7c7df-0d18-4bc1-9096-2403b1178...(a)x25g2000yqj.googlegroups..com>,
> Paul Branon  <paulbra...(a)googlemail.com> wrote:
>
> >in the output of bind -P
>
> Apparently that's a bash command...
>
>
>
> >what does
>
> >beginning-of-line can be found on "M-OH", "M-[H"
>
> Oh boy...
>
>
>
> >precisely which key sequences are these?
> >M-OH", "M-[H"
>
> This is an example of a notation used only by emacs devotees, which vi
> users don't normally need to know about. "C-" is short for "Ctrl-" and
> "M-" is short for "Meta-", which really mostly means "Alt-" since
> genuine Meta keys are hard to find.
>
> So literally, "M-OH" means Alt-O followed by H. If you type that
> sequence, you may find that it actually works, moving the cursor to
> beginning-of-line. But that's not the intended usage.
>
> The Alt key in a terminal has 2 common behaviors: either it sets the
> high bit of the character (so the O is modified from ASCII code 0x4f to
> 0xcf) or it prefixes the character with an Escape (so Alt-O generates
> 0x1b 0x4f).
>
> Thus "M-OH" can be translated into non-emacs-speak as one of these:
>   "^[OH"
>   "\033OH"
>   ESC O H
>
> And "M-[H" is "^[[H"
>
> Which is the escape sequence generated by the "Home" key, in many
> terminal types.
>
> If you want to get away from this weird influence of the church of emacs
> (showing up even in the display of "vi mode" keybindings!), one way
> would be to use zsh, which uses the more unix-normal "^[[H" style in the
> equivalent bindkey command.
>
> --
> Alan Curry


Thanks muchly, Alan.
 | 
Pages: 1
Prev: hostname and DNS
Next: download basics