Getting the current row number?

后端 未结 6 1466
别跟我提以往
别跟我提以往 2021-01-31 07:15

Is there any key mapping that outputs the current row number of the line being edited? Or, even better yet, can we do formulas based on the output of the key mapping?

I

6条回答
  •  攒了一身酷
    2021-01-31 08:13

    You can get the visual width of the current cursor position with virtcol('.'); insert that into the buffer through the expression register, e.g. in insert mode with =virtcol('.')

    Note that the width is different from the number of characters when the line contains double-width characters, or unprintable characters.

提交回复
热议问题