Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16367

Re: Vi mode and g commands

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: Vi mode and g commands
Date 2020-06-08 09:34 -0400
Message-ID <mailman.1434.1591623278.2541.bug-bash@gnu.org> (permalink)
References <CADB0MOOUui+hUpwsNsX-XLxcjSfE+sEox8cRA4hG7x1ksT49zQ@mail.gmail.com> <20200608133434.GA4133@eeg.ccf.org>

Show all headers | View raw


On Mon, Jun 08, 2020 at 02:28:05AM +0100, Dan Shearer wrote:
> Some g commands are implemented, but incorrectly. Examples:
> * g0 is equivalent to 0, rather than 'beginning of screen line when wrapped'
> * g$ is equivalent to $, rather than 'end of screen line when wrapped'
> 
> Other g commands are not implemented, just ignored. Examples:
> * gM is ignored, rather than going to the middle of the line
> * gE is ignored, rather than going to the end of the last word

Those are not standard vi commands, as far as I can tell.  They appear
to be vim extensions.

I opened /usr/bin/vi on HP-UX 11i and typed a line that was longer than
my terminal's width, and then tried these commands.  They do not do what
you describe.

In real vi, in an 80-wide terminal, with a single line of 120 or so
characters, and the cursor at position 40, g$ acts just like $.

With the cursor now at the end of the line, g0 acts just like 0.

gE acts just like E (moves to the end of the current word).

gM acts just like M (moves to the start of the middle line, which happens
to be the first line, because there's only one line).

I see no evidence that 'g' is even a meaningful keystroke in real vi.
Maybe that's why vim chose it as the prefix for so many of their
extension commands.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Vi mode and g commands Greg Wooledge <wooledg@eeg.ccf.org> - 2020-06-08 09:34 -0400

csiph-web