vi navigation - dylanwan/dylanwan.github.io GitHub Wiki
Quickly move around: These command "jump"
- G - move the cursor to the end of the file
- gg - move the cursor to the top of the file
Here are the movement keys - micro-movement
- <return> or + (plus sign) - move to the next line and have the cursor at the beginning of the line
-
- (minus sign) - move the cursor up to the prior line at the beginning of the line
- <space> - move one char forward
return and - are good comparing to
- j - move the cursor down to the next line at the relative same place in the line
- k - move the cursor up to the prior line at the same position within the line
- l - the same as <space>
j and k are useful if the file is in a structured format. You can keep the cursor on the same position within the line.
jump multiple lines by entering a number then hit
- 10 and < return > - move the cursor down ten lines
- 10 and - (minus sign) - move the cursor up ten lines
- 10 and j
- 10 and k
You can also use ctrl-u (up) or ctrl-d (down) or ctrl-f (forward) or ctrl-b (backward)
The numbers of line moved is controlled by entering a number then hit the key
13 gg - go to specific line. This command lets you to go to line 13 an equivalent to this is to type ":13"
Another way is to use 13G. G = Go. But you need to hit < Shift Key > + < g >. I prefer gg.
Cursor movement within a line
- f - move the cursor to a specific char within the line
- F - move the cursor backward to a specific char within the same line
- t - move the cursor right before the character. found here
- ; - search again
- , - reverse the direction and search (not working on macpro)
- w - move one word, word and word are separate by space or special char
- W - move one word, word and word are separate by space only
- b - move backward one word
- B
- e - to the end of a word
- E - to the end of a wword
The command w, e, b are frequently used in moving within a line but can be used to move out of a line, too. To quickly move out, you can use } to move to the next paragraph. { - back to the previous paragraph.
- w, b, e - move by words
- {, } - move by paragraphs
- (, ) - move by sentences
Move the cursor within the screen
- H - highest line on the screen
- M - middle of the the screen
- L - Lowest line shown on the screen.