Vim: move around quickly inside of long line

后端 未结 8 660
轻奢々
轻奢々 2020-12-22 18:50

I have word-wrap enabled and tend to have quite long lines. But moving around inside a line that\'s actually 4 lines high with \"w\" is cumbersome. I keep using / to jump to

8条回答
  •  甜味超标
    2020-12-22 19:21

    My preferred strategy while jumping around long lines is to use f F and t T to zero in on the character. What makes this family of motions supercharged is that you can utilize the ; and , motions, so you don't have to count the position of character relative to cursor, but just step through them (extremely useful with ' " . etc)

    Let's say we have a line:

    reallyLongObjectName.longMethod().prettyPrettyLongMethod().burp();
    

    If we need to jump to, say, the third dot from the beginning of the line, we can use either 3f. or f.;; visiting two dots and landing on third.

    While the ; , style can use more keystrokes, I found it more agile and fun overall.

提交回复
热议问题