获取当前行号?

获取当前行号?

问题描述:

是否有任何键映射可以输出正在编辑的行的当前行号?或者,更好的是,我们可以根据键映射的输出来制定公式吗?

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?

我想获取行号并将 1 添加到当前正在编辑的文本中.

I want to get the row number and add 1 to the current text being edited.

@ZyX 在对另一个答案的评论中给出了答案:

The answer was given by @ZyX in a comment to another answer:

您有 <C-r> 处于插入模式用于此类事情:

You have <C-r> in insert mode for this kind of things:

nnoremap i=line('.')+1