且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Vim自动完成,带有当前文件和字典

更新时间:2023-01-28 13:34:47

默认完成(在插入模式下为<C-N>/<C-P>)使用在'complete'中配置的源.如果此选项值包含.k,则同时考虑当前缓冲区和字典(触发完成后,您可能会很快看到诸如Scanning tags...之类的消息,指示正在搜索当前源).

The default completion (<C-N> / <C-P> in insert mode) uses the sources configured in 'complete'. If this option value contains . and k, both current buffer and the dictionary are considered (you might shortly see messages like Scanning tags... etc. after triggering completion that indicate the current source being searched).

这就是默认完成的全部目的;相比之下,您必须使用不同的完成命令(例如<C-X><C-K>用于字典)才能使用单个源.

That's the whole purpose of default completion; in contrast, you have to use different completion commands (e.g. <C-X><C-K> for dictionary) to use a single source.

编辑:您需要确保k值确实存在. ~/.vim/view/表示您正在还原保存的视图;尝试清除这些视图并删除现有的.viminfo文件以覆盖'complete'的所有旧持久值.

Edit: You need to ensure that the k value actually persists; the ~/.vim/view/ suggests you're restoring a saved view; try clearing those views and removing your existing .viminfo file to override any old persisted values of 'complete'.