Vim cursor movement can help us quickly locate the position.
This article will show you how to use vim shortcut keys to move the cursor.
Vim cursor movement shortcut keys:
- up, down, left, and right
- keyboard direction keys
- k, j, h, l
- to the top of the file: gg
- to the bottom of the file: G (shift g)
- to the top of the screen: H (shift h)
- to the bottom of the screen: L (shift l)
- to the end of the line: $
- to the beginning of the line: ^
- to the end of the next word: e
- to the beginning of the next word: w
- to the next same word: #
Examples
In the following example, use vim shortcut keys to move the cursor to the end of the screen and move the cursor to the end of the file.
- Open the terminal and use vim to open the file: go.sh
2. In normal mode, press shift + l to move the cursor to the end of the screen.
3. In normal mode, press shift + g to move the cursor to the end of the file.