Vim:为什么不“:正常!我“进入插入模式?

前端之家收集整理的这篇文章主要介绍了Vim:为什么不“:正常!我“进入插入模式?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在vim中,如果我从命令行执行以下命令
:normal! i

vim不进入插入模式。同样的命令

:normal! A

将光标移动到行尾,但光标保持在插入模式。

任何想法为什么这不工作?没有,我想知道从vimscript函数的主体进入插入模式的另一种方式(当然函数返回之后,插入模式保持不变)。

编辑:看起来像:startinsert将填满问题的第二部分,但我仍然想知道我可以做些什么:正常! A或:正常!一个为什么那些不能像预期那样工作。用箭头运动模拟“追加”是一个坏的解决方案,因为像空行等等。

普通命令以insert方式结束为一个不完整的命令,并中止。从帮助正常:

{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. The display isn’t updated while “:normal” is busy. This
implies that an insert command must be completed (to start Insert
mode,see :startinsert)

:startinsert可能是您要查找的命令。

:正常A可以通过追加一个爆炸(!)来启动插件,如Ingo Karkat所建议的。从帮助startinsert:

When the ! is included it works like “A”,append to the line.

原文链接:https://www.f2er.com/bash/387528.html

猜你在找的Bash相关文章