Tuesday, June 10, 2014

Re: Having trouble grokking the g family of commands

On 2014-06-10, Chris Pickard wrote:
> Every time I discover a new command with a g prefix it makes me
> realize that I don't really understand the g prefix at all. I
> assume that the "g" means "go," like in gd it means go to
> declaration, or gg is go to top of file, and I've done :help g,
> but there is also g~, which is swap case for a motion, or ga which
> prints the ascii value of the character under the cursor.
>
> Can anyone explain the language of the g family of commands to me?
> It seems like there are a lot of random, really useful things in
> there that I just can't discover because it doesn't seem to follow
> a pattern to me.

g was one of the few keys not used in normal mode by the original
vi, at least the HP-UX version. From an old set of notes, the
unused keys were:

* K V \ ^@ ^A ^C ^K ^O ^Q ^S ^T ^V ^W ^X ^Z ^\ ^_ g q v

Rather than use such a scarce resource for a single function, g was
used by Vim as a prefix which could be followed by any single key to
double the number of relatively-easy-to-type commands.

Some of the g commands can be thought of as "go to" something.
Others are a modified form of the command corresponding to the
single letter following. Others are just what they are because
there are only so many letters on the keyboard and they can't all
make mnemonic sense.

A list of all the commands starting with 'g' is at

:help g

There is a similar list of commands starting with 'z' at

:help z

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment