有没有办法改变vim的默认模式
有谁知道如何更改vim的默认模式?它的默认模式是命令模式,但是我可以将其更改为插入模式吗?
Does anyone know how to change vim's default mode? Its default mode is command mode, but could I change it to insert mode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
只需将以下行添加到您的 vimrc 中即可:
Vim 的默认模式将更改为插入模式。只需按 Esc 即可进入命令模式。
Just add the following line to your vimrc:
Vim's default mode will be changed to Insert mode. Just press Esc to enter Command mode.
您可以尝试“insertmode”选项(将
set insertmode
添加到您的 .vimrc 文件中),不过我建议您学习标准 vi 操作,因为并非所有类似 vi 的编辑器都支持这种工作模式。干杯,
米奇
You can try the 'insertmode' option (add
set insertmode
to your .vimrc file), although I recommend that you learn the standard vi operation, because not all vi-like editors support this mode of work.cheers,
mitch
如果您确实想要一个以插入模式启动的编辑器,也许 vim 不适合您。
大多数不基于 vi 的编辑器都会按照您想要的方式运行。 Emacs 非常强大,但对于您的需求来说可能过于复杂。 Nano(
man nano
表示info nano
了解更多信息)可能是一个不错的选择。还有其他可能性。vim 确实不是为了这样使用而设计的。正如其他人所说,有一些方法可以强制它以插入模式启动。 (我已经使用 vi 风格的编辑器几十年了,直到现在我什至不知道
:set insertmode
。)但是使用起来很尴尬。我的建议:要么(1)使用一个按照你想要的方式运行的编辑器,要么(2)花一些时间学习在默认配置下使用 vim,看看你是否能习惯它。
vim 插入和命令模式分离的一大优点是命令模式可以使用字母作为命令;无模式编辑器通常必须使用控制键或功能键来执行命令。
更新(十年后):vim 有一个选项
-y
,可以在启用insertmode
的情况下启动它。evim
相当于vim -y
,eview
相当于view -y
。从手册页(添加强调):If you really want an editor that starts out in insert mode, perhaps vim is not the editor for you.
Most editors that aren't based on vi behave the way you want. Emacs is very powerful, but it may be too complicated for your needs. Nano (
man nano
forinfo nano
for more information) might be a good choice. There are other possibilities.vim really isn't designed to be used that way. As others have said, there are ways to force it to start up in insert mode. (I've been using vi-style editors for decades, and I didn't even know about
:set insertmode
until now.) But it's awkward to use.My advice: either (1) use an editor that behaves the way you want, or (2) spend some time learning to use vim in its default configuration, and see if you can get used to it.
One big advantage of vim's separation of insert and command modes is that the command mode can use letters as commands; modeless editors generally have to use control keys or function keys to execute commands.
Update (a decade later): vim has an option
-y
that starts it withinsertmode
enabled.evim
is equivalent tovim -y
, andeview
toview -y
. From the man page (emphasis added):您可以使用
或
启动 vi 并将其置于插入模式。如果它真的有用的话,你可以为其设置一个别名(无论如何我仍然理解你为什么想要它)。您还可以查看此提示。
You can use
or
That launch vi and put it insert mode. You can do an alias to that if it's really usefull (I still understand why you want that anyway). You can also look at this tip.
“Cream”是一个旨在使 Vim 更易于使用的项目。默认情况下,您在 Cream 中执行的所有操作都处于插入模式,我相信:
http://en。 wikipedia.org/wiki/Cream_%28software%29
"Cream" is a project that aims to make Vim easier to use. By default everything you do in Cream is in insert mode, I believe:
http://en.wikipedia.org/wiki/Cream_%28software%29