切换到插入模式时是否可以切换 vim 选项?
我最近发现了拼写选项,这要归功于 代码上的这个答案回顾一下,我觉得该选项既非常有用(在编辑时)又非常烦人(在阅读代码时,因为所有误报)。
我想以某种方式在切换到插入模式时自动启用该选项:
set spell
并在切换回正常模式时自动禁用它:
set nospell
I recently discovered the spell option thanks to this answer on Code Review, and I feel that the option is both really useful (while editing) and really annoying (while reading code, because of all the false positives).
I would like to somehow enable the option automatically when switching to insert mode:
set spell
and disable it automatically when switching back to normal mode:
set nospell
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
.vimrc
中添加以下命令应该可以解决问题(只要您不使用 CTRL+C 退出插入模式):由于这是一个很棒的技巧,我已将这些行添加到我的 <代码>.vimrc!
如果您想删除突出显示的单词,可以将光标放在单词上并输入
zg
将它们添加到“好”单词列表中。请参阅:helppell
了解更多信息Adding the following commands in your
.vimrc
should do the trick (as long as your not using CTRL+C to leave insert mode) :Since this is a great trick, I have added these lines to my
.vimrc
!if you want to get rid of words being highlighted, you can add them to the "good" word list by putting the cursor over them and type
zg
. See:help spell
for more information