如何禁用 omnifunc 的自动写入建议?

huangapple go评论78阅读模式
英文:

How to disable omnifunc autowrite suggestions

问题

我刚开始使用vim,今天我安装了vim-go插件。我使用gopls设置了自动补全,并将omnifunc设置为go#complete#Complete。它按预期工作,但它总是自动写入当前的建议,这非常令人烦恼,因为它总是在我接受之前就写入了建议。

英文:

I am new to vim and I installed vim-go today. I set up auto completion with gopls with omnifunc set as go#complete#Complete. It works as expected but it always writes the current suggestion automatically. this is very annoying since it always writes the suggestion without me accepting it.

答案1

得分: 1

原来问题是vim中completeopt选项的默认值。将其编辑为noinsert的值解决了问题。在~/.vimrc文件中添加以下行:

set completeopt=menuone,popup,noinsert

上述只是一个示例,除了noinsert之外的值只是我个人的偏好。

英文:

It turns out the problem was the default value of completeopt option in vim. editing it to have the value noinsert solved the problem. add the following line in ~/.vimrc<br><br>
set completeopt=menuone,popup,noinsert<br><br>
The above is just an example. the values except noinsert are just my own preferences.

huangapple
  • 本文由 发表于 2022年5月28日 03:34:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/72410284.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定