how do you insert ^[ in vi?
Kenneth Brody
kenbrody at bestweb.net
Fri May 28 10:39:07 PDT 2004
Fairlight wrote:
[... Ctrl-V and stty's "lnext" ...]
> >
> > It's also only in "cooked" mode. Since most (all?) full-screen programs
> > (including vi and filePro) run in raw mode, it has no effect on them.
>
> Please clarify. Does this mean that while at the shell level (or in other
> cooked-mode programs) it works via stty, but vi and the like internally
> emulate the behaviour and they key configuration would be unalterable via
> stty? I've never had occasion to change it.
In cooked mode, the tty device driver is handling the input, including
things like ctrl-H (or stty's "erase" key) for backspace, and ctrl-U
(stty "kill") to kill the entire line, and so on.
Try it: (assuming erase=^H and kill=^U)
foobar^Uek^Hcho hello
This should echo "hello", as the ctrl-U killed all previous input,
and the ctrl-H's corrected the typo.
Now, do the same things after "stty raw". (Remember to use ctrl-J
to end each line, as ctrl-M will no longer work.) You should get
and error that "foobar^Uek^Hcho" is not found, as these keys no
longer had any meaning.
It's not that the shell handled these characters, but rather that
the terminal's device driver handled them. (Though it is possible
that some shells handle it themselves, allowing ksh's line edit
mode for example.)
I can't speak for exactly how vi does it, but vi itself handles the
"literalize" functionality of Ctrl-V. Whether it has Ctrl-V hard-coded,
gets it from termcap/terminfo, or reads the stty settings upon startup,
I don't know. Try using stty to change lnext to something else and see
what vi does.
--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody at spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
More information about the Filepro-list
mailing list