简体   繁体   English

Vim-自动始终使用自动补全

[英]Vim - Automatically always use autocompletion

I am trying to use vim on Mac OS X High Sierra for coding java. 我试图在Mac OS X High Sierra上使用vim进行Java编码。 If I want to use auto-completion I have to press ctrl + n . 如果要使用自动完成功能,则必须按ctrl + n

Is there a way to do it automatically (without pressing a key) but with a way to turn it off? 有没有一种方法可以自动执行此操作(无需按任何键)却可以将其关闭?

Vim doesn't come with autocompletion built-in; Vim没有内置自动完成功能。 only manual completion. 仅手动完成。

If you want autocompletion you will need a plugin. 如果您要自动补全,则需要一个插件。 A quick Google search will give you many to choose from. 快速的Google搜索将为您提供许多选择。

The built-in completion has to be manually triggered. 内置完成必须手动触发。 As there are several different key combinations (see :help ins-completion ; the fact that so many different ones are available is a side effect of Vim's mode-based model), you can choose the right one depending on the use case. 由于有几种不同的组合键(请参阅:help ins-completion ;事实上,有许多不同的组合是Vim 基于模式的模型的副作用),因此您可以根据用例选择合适的组合键。

However, many users have gotten used to automatic suggestion of completion candidates, as many IDEs provide this. 但是,许多用户已经习惯于自动建议完成候选人,因为许多IDE都提供了这一功能。

In Vim, you have multiple options: 在Vim中,您有多种选择:

  • Use a full-fledged completion plugin (like YouCompleteMe ) modeled after IDEs. 使用以IDE为蓝本的功能完善的完成插件(例如YouCompleteMe )。 Many of those have the auto-completion feature built in. 其中许多具有内置的自动完成功能。
  • The AutoComplPop plugin can run any built-in (and custom) completion automatically. AutoComplPop插件可以自动运行任何内置(和自定义)补全功能。 It's not maintained any longer, but still works well if all you want is the automatic triggering. 它不再维护,但是如果您只需要自动触发,它仍然可以很好地工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM