Well, obviously, for h , j , k , l , apparently, there is a finger position pattern.
The fact that ^ goes to the beginning of a line and $ goes to the end has a pattern with common regex syntax.
Ctrl-F and Ctrl-B back and forth, and it's pretty intuitive.
i inserts (before) and a are added (after the cursor). Similar,
i inserts at the beginning of the line, and a is added at the very end.
> and < indent and outdent respectively. This is also kind of intuitive.
But in general, many other commands are on all the remaining keys - it is difficult to find an intuitive mapping between the letters of the alphabet and the editor's commands.
Repeated counts are always entered before the team and basically repeat this command many times, but in some cases do something clever, but similar.
I think the secret to not being embarrassed about vi is to start with a small team. I have many colleagues who know nothing but
- move the cursor with the arrow keys (you do not need to use h , j , k , l );
- paste with i , delete with Del (you don't need to use x );
- delete row with d d
- exit input mode with Esc
- exit vi with : x (exit) or q! (close and discard my changes!)
Since I am much smarter, the additional commands that I know and use are as follows:
- go to the top of the file with g g , below g .
I can go to the specified line number with (line number) g . - copy the string with y (yank), paste it with p
- change the word with c w , the rest of the line with c
- delete the word with d w , the rest of the line with d
- I sometimes use it . to repeat the last command or u (cancel) if I messed up.
When you can use other commands, you can teach them yourself as needed.
Carl Smotricz
source share