问题描述
YouCompleteMe(YCM)和jedi-vim是两个提供自动补全功能的vim插件,它们都在Python底下使用jedi.但是,最好同时拥有这两个功能,因为jedi-vim除了提供文档外还提供了一些有用的功能,例如转到定义"和查看文档字符串",而YouCompleteMe可与其他语言一起使用.
YouCompleteMe (YCM) and jedi-vim are two vim plugins that provide autocompletion, and both use jedi underneath for Python. However it's nice to have both since jedi-vim provides some useful features in addition to documentation, like 'go to definition' and 'view docstring', while YouCompleteMe works with other languages.
由于两者均提供Python自动完成功能,是否需要任何特殊的配置来防止这两个插件发生冲突?还是jedi-vim的自动完成器会简单地覆盖Python中的YCM?
Since both provide Python autocomplete, is any special configuration needed to prevent the two plugins from conflicting? Or will jedi-vim's autocompleter simply override YCM in Python?
推荐答案
最明显的冲突是不知道您是使用YCM还是Jedi进行自动补全.在这种情况下,最简单的方法是用.vimrc
中的一行禁用Jedi的自动补全功能,并在各处使用YCM出色的自动补全功能(Jedi为Python提供动力).
The most obvious conflict is not knowing whether you are using YCM or Jedi for autocompletion. In that case the simplest thing to do is to disable Jedi's autocompletion with a line in .vimrc
, and use YCM's awesome (Jedi-powered for Python) autocomplete everywhere.
let g:jedi#completions_enabled = 0
键映射还不错.这两个插件都映射<leader>d
(其中<leader>
默认为\
),但这并不重要,Jedi仅会覆盖Python文件中的\d
,并且Python不支持特定的YCM功能.
The key mappings are not too bad. Both plugins map <leader>d
(where <leader>
defaults to \
) but it doesn't matter, Jedi will override \d
in Python files only and that particular YCM feature is not supported in Python.
这篇关于jedi-vim是否与YouCompleteMe冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!