Use of g key in vim normal mode
VimVim Problem Overview
In vim's normal mode, the g
prefix is used for a number of commands. Some commands go somewhere in the document, but other commands deal with file encodings and swapping upper/lower case letters.
ga
- show character encoding10gg
- go to line 10gg
- go to line 1gH
- start Select line modegr
{char} - virtual replace N chars with {char}
What is the missing connection between all these commands?
Vim Solutions
Solution 1 - Vim
There's no greater connection to g
-commands: it's a mixed bunch. It is an easy prefix and the unbound keys were getting extinct so the less-used maps found a good place behind g
.
Solution 2 - Vim
Simply you're talking about two different things. In some cases g is the short way of "global" (for range command for example), for line moving the g stands for goto.
In VIM commands are often shortened for quick of use.
:help global
may help
Btw: for line navigation I've always used the :<lineno>
syntax.