Go to n-th symbol in line

后端 未结 3 2004
栀梦
栀梦 2021-01-30 08:10

How to move cursor to the n-th symbol from the left in Vim?

One of the solutions I see is press 0n, it will move to the n+1 position. Is

3条回答
  •  清酒与你
    2021-01-30 08:51

    I'm not sure if you mean the nth character or nth occurrence of a character; the second has been answered so I will answer the first.

    ^ will take you to the start of the line excluding whitespace (so to the first non-white column) and | (pipe) or 0 (zero) will take you to the first character. Then l (lowercase L) will take you to the right; and 7l will take you seven characters to the right. So all together, to go to the (n+1)th character on the line, for n=7, 07l.

提交回复
热议问题