Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 :cabbr :
:cabbr fil v/<c-r><c-w>/d
我希望在一个函数中执行它(光标已经正确定位)。
我应该如何进行?
提前致谢
cabbrev abc echo 'foo' function! Foo() call feedkeys(':abc ^M') endfunction
(^M在这种情况下是按下<c-v><cr>。)
^M
<c-v><cr>
现在:call Foo()将输出foo.
:call Foo()
foo
编辑:正如人们在评论中指出的那样,feedkeys(':abc ^M')也可以替换为feedkeys(":abc\<cr>").
feedkeys(':abc ^M')
feedkeys(":abc\<cr>")