freeCodeCamp/guide/chinese/vim/navigation/index.md

1.4 KiB
Raw Blame History

title localeTitle
Navigation 导航

Vim导航

基本动作

有许多方法可以在Vim中移动光标但这些基本动作将允许 新用户可以使用普通模式进行文件导航。

  • 在正常模式下,键h j k l对应于移动光标 一个字符分别为左,下,上和右。

  • 要一次导航一个单词,键wb将光标移动到 下一个单词的开头,或前一个单词的开头。 e 键将光标移动到当前单词的末尾。

  • 要移至当前行的开头,请键入0 ,然后移至末尾 当前行,键入$

  • 最后,要移动到文件的第一行,输入gg ,然后移动到 在文件的最后一行,输入G

综上所述:

h   moves one character left 
 j   moves one row down 
 k   moves one row up 
 l   moves one character right 
 
 w   moves to the beginning of the next word 
 b   moves to the beginning of the previous word 
 e   moves to the end of the current word 
 
 0   moves to the beginning of the current line 
 $   moves to the end of the current line 
 :n  moves to line n (ex. :23 moves to line 23) can also use nG 
 
 ZZ  moves to the center of the line your on 
 H   moves to the top of the screen 
 M   moves to the middle of the screen 
 L   moves to the bottom of the screen 
 
 gg  moves to the first line in the file 
 G   moves to the last line in the file