Vim Study Book(part 2)--Cursor motion
Cursor motion

The mode
![]() |

h j k l
h j k l are the four most basic cursor motion commands. You should use the index finger to press h and j, use your middle finger for k and your ring finger for l. These commands are designed for efficiency of your work and the comfort of your hand, but not so that you can do without learning. You should practice until they become of your instincts. Try open a file and use only your right hand to browse the whole file and move the cursor around, without looking at the keyboard. To practice effectively, never use the arrow keys and the mouse.
Faster
After you get used to h j k l, you may find these commands a bit slow. Yes, they are for short range movements. To move quickly, you need to learn other commands.
Even faster
But how do we know the number of a line? Usually we don't know. Therefore, usually we only use G and 1G, which take us to the end or the beginning of the file. Of course, you may have an estimate of the line number where you want to go. Then just go there and then use j k to adjust the cursor location further.Move by screen.
Press Ctrlf moves you forward by one screen of text, and Ctrlb moves you backward by one screen of text.
:map
:map

Know what you really want

Move cursor by searching a pattern
Sometimes you don't know where your target is, but you know what your target is. Then don't browse the file from start to end, word by word. That is harmful to your eyes. Try searching the word or the pattern using the slash command /. For example, you want to move the cursor the word target, you can type/target
Then the cursor will jump to the first occurrence of target. If this target is not your target, just keep pressing
nto go to subsequent occurrences of the word target untill you find your target.
/Section 1

Move cursor by searching a character
Search a character within the line. The f and F commands can be used to move cursor quickly. To move the cursor to the first occurrence of a character c in the current linefcTo go to the first occurrence of a character c in the left
FcIf one fc didn't take the cursor to the desired place and you need to repeat the search, remember that instead of doing fc again, you can use the semicolon command to repeat the last fc or Fc search
;in the same direction, and use the comma command
,to do it in the opposite direction. This can be very handy since the semicolon and comma keys are very easy to hit.
Labels: ASIC/IC Studybook
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home