我正在我的 vimrc
中定义自己的命令:
command! Tcs :normal lvf`hc
目的是我继续反引号,它将删除从此处到下一个反引号的内部内容。喜欢:
`hi there` -> ``
问题是仍然处于正常模式,我想复制 c
命令行为,以便我可以在 插入 模式下立即开始输入。
我已经尝试过命令! Tcs :normal lvf`hc :startinsert
但我在最后一个 c
之后输入的任何内容都将直接在编辑器中输入。
谢谢
最佳答案
来自:help :normal
>
:norm[al][!] {commands} *:norm* *:normal* (...) {commands} should be a complete command. If {commands} does not finish a command, the last one will be aborted as if <Esc> or <C-C> was typed.
This implies that an insert command must be completed
.(...)
在您的情况下,命令正常
已被中止,这就是您仍处于正常模式的原因。您仍然可以尝试 :normal!我
要得到你想要的东西,你可以这样做:
command! Tcs execute "normal lvf`hd" | :startinsert
关于vim - 从 Vim 中的用户定义命令切换到 **插入** 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41805215/