Using the g Key in vim Normal Mode

In normal vim mode, the g prefix is ​​used for several commands. Some commands go somewhere in the document, but other commands process file encodings and replace upper and lower case letters.

  • ga - show character encoding
  • 10gg - go to line 10
  • gg - go to line 1
  • gH - start Select line mode
  • gr {char} - virtual replacement of N characters with {char}

What is the lack of connection between all these teams?

+45
vim
Oct 03 2018-11-11T00:
source share
2 answers

There is no closer connection with g commands: this is a mixed group. This is a simple prefix, and the unrelated keys are extinct, so less used cards have found a good place behind g .

+39
Oct 03 '11 at 8:18
source share

You are just talking about two different things. In some cases, g is a shortcut to the "global" path (for example, for a range command); to move a string, g means goto.

VIM commands are often shortened for quick use.

:help global can help

Btw: for linear navigation, I always used the syntax :<lineno> .

+11
Oct 03 '11 at 8:11
source share



All Articles