NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: stupid question on vi



At Mon, 24 Feb 2025 22:11:02 +0000 (UTC), RVP <rvp%SDF.ORG@localhost> wrote:
Subject: Re: stupid question on vi
>
> On Sun, 23 Feb 2025, Greg A. Woods wrote:
>
> > At Sun, 23 Feb 2025 06:44:02 +0000 (UTC), RVP <rvp%SDF.ORG@localhost> wrote:
> > Subject: Re: stupid question on vi
> >>
> >> nvi(1) has a poorly-documented Ctrl-X key
> >
> > Looks very well documented to me:
> >
> >       <control-X>[0-9A-Fa-f]+
> >              Insert a character with the specified hexadecimal value into the
> >              text.
> >
>
> Well, how many chars. does that `+' imply? Depends on the version of nvi(1) you
> have. The Ubuntu/Debian version permits more than 2, so you can type in Unicode
> code-points for emojis. The *BSD versions (nvi and nvi2) don't.
>
> In a UTF-8 locale, are the 2 hex-chars. converted to UTF-8 chars? Yes, on
> Net and FreeBSD, but, not on OpenBSD.

Versions other than the one in NetBSD really aren't relevant here.  :-)

> The man-page, as you've shown, says "into the text", which implies input into
> the document text

"imply"?  I would say it's pretty explicit.  The word "text" (when not
appearing before the word "editor") in the manual page usually refers to
"document text", though there are exceptions, such as "/text"
(i.e. search text).

To nail it down even more the section where ^X is described is headlined
with the opening text:

       The following section describes the commands available in the text
       input mode of the vi editor.

I.e. effectively they're "non-modal" commands, or rather "mode-specific"
commands!  Hmmm... vi has commands that can be entered without being in
command mode!


> (set fileencoding=...).

Now that's something that's not documented!  (at all, so far as I can
find within NetBSD)

> But, what about, at the prompt, like
> `/' or `:'? Can I create a filename using that <Ctrl-X>NN?

I wouldn't expect any such thing given what the documentation says
("available in text input mode", implying _not_ available in command
mode, though clearly some of the others do work in command mode), so if
it works, well, that'd be nice.

I am still puzzled by the lack of mention in the built-in cheat-sheet.

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpFpXbM_LbJA.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index