Pressing “Home” in Vim on an Indented Line

前端 未结 5 1236
不知归路
不知归路 2021-02-07 07:36

I have a bad habit of using the \'home\' key to go back to the beginning of a line. As I recently started using vim I noticed that when I press the home key on a lined that is i

5条回答
  •  北荒
    北荒 (楼主)
    2021-02-07 08:02

    There are two usual ways to go to the "beginning" of a line in Vim:

    • 0 (zero) go to the first column of text
    • ^ go to the first non-whitespace on the line

    I find that using 0w is usually the most convenient way for me to go to the first nonblank character on a line, it's the same number of keys as ^ and is easier to reach. (Of course, if there are no leading spaces on the line, don't press w.)

提交回复
热议问题