2

我正在使用带有 neocomplcache 插件的 Vim,它在完成时提示使用的功能让我非常困惑。

它的行为是这样的:我<C-X><C-U>在光标位于末尾时键入os.path.,然后不仅完成候选列在行下,而且包含第一个候选的文档字符串的水平拆分出现在顶部。我的问题是:如何摆脱这个功能,以便我只在没有使用提示的情况下完成代码?

在此处输入图像描述

4

1 回答 1

10

这都是因为preview默认completeopt情况下,你可以通过 type 命令看到它的值,:set completeopt结果应该是completeopt=menu,preview.

我们需要的只是menu,所以剪掉preview,在你的 vimrc 中添加这一行:

set completeopt-=preview

vim 帮助参考:

                        *'completeopt'* *'cot'*
'completeopt' 'cot' string  (default: "menu,preview")
            global
            {not available when compiled without the
            |+insert_expand| feature}
            {not in Vi}
    A comma separated list of options for Insert mode completion
    |ins-completion|.  The supported values are:

       menu     Use a popup menu to show the possible completions.  The
            menu is only shown when there is more than one match and
            sufficient colors are available.  |ins-completion-menu|

       menuone  Use the popup menu also when there is only one match.
            Useful when there is additional information about the
            match, e.g., what file it comes from.

       longest  Only insert the longest common text of the matches.  If
            the menu is displayed you can use CTRL-L to add more
            characters.  Whether case is ignored depends on the kind
            of completion.  For buffer text the 'ignorecase' option is
            used.

       preview  Show extra information about the currently selected
            completion in the preview window.  Only works in
            combination with "menu" or "menuone".
于 2012-11-28T18:39:08.133 回答