I would like to know if it is possible to add spaces (30 spaces) at cursor position
I tried to do it with regex but I don't know how to represent the actual cursor position in regex.
I would like to know if it is possible to add spaces (30 spaces) at cursor position
I tried to do it with regex but I don't know how to represent the actual cursor position in regex.
30iSPACE will add 30 spaces at the cursor position in command mode.
"a 定义寄存器 a,如果你用 "ax 剪切一个空格,则寄存器 a 有空格。然后使用:
30"ap
注意:寄存器不要忘记它的值,所以第一个解决方案更有用。
除了已经给出的答案之外,我可以说光标位置用正则表达式表示\%#
,因此s/\%#/\=repeat(" ", 30)/
将在光标位置添加 30 个空格,就像30i<Space><Esc>
.