我很困惑如何从函数内部使用寄存器。例如,如果我想从 vim 中拉出当前单词以注册“k”,我会使用命令/击键
"kyw
但这在函数内部不起作用:"开始评论:
function MyFunction()
"kyw
"^^^ does not work because it is a comment...
let @k="I can set register k directly to text..."
" but that's not the same
yank k "I can yank an entire line, but still not the same
endfunction
有没有办法在不更改评论选项的情况下做到这一点(这甚至可以工作吗?)谢谢;我一整天都在反对这个。