自动完成时不区分大小写

时间:2011-02-13 21:54:56

标签: vim autocomplete

我在互联网和Vim的帮助下搜索了很多,所以我希望这不是一个重复的问题......无论如何:

有没有办法在Vim的自动完成功能中打开不区分大小写?我显然不打算使用它进行编码,但是我在Vim中写了很多文本,我想念复杂和/或长词。

例如,假设我写了:

  

火山肺矽病   是一种疾病...

现在我要写:

  

肺炎患者

然后<C-n>和bang :-P

3 个答案:

答案 0 :(得分:13)

根据文档,您似乎可以使用以下两个选项:ignorecaseinfercase

  'infercase' 'inf'     boolean (default off)
            local to buffer
            {not in Vi}
When doing keyword completion in insert mode |ins-completion|, and
'ignorecase' is also on, the case of the match is adjusted depending
on the typed text.  If the typed text contains a lowercase letter
where the match has an upper case letter, the completed part is made
lowercase.  If the typed text has no lowercase letters and the match
has a lowercase letter where the typed text has an uppercase letter,
and there is a letter before it, the completed part is made uppercase.
With 'noinfercase' the match is used as-is.

根据文档,它适用于ins-completion,即在插入模式下自动完成。

您应该在.vimrc中添加以下选项:
set ignorecase
set infercase

答案 1 :(得分:6)

对于问题中描述的用例没有用,但可能还是有趣的:

:set wildignorecase  " Ignore case when completing file names and directories.
                     " Has no effect when 'fileignorecase' is set, which is the case (no pun intended)
                     " by default for systems where case in file names is normally ignored,
                     " notably Windows.

在SO:D上找到它 这是一个非常新颖的功能,只有7.3.072可用。

答案 2 :(得分:2)

我不知道wildignorecase,但是

:set ignorecase

为我做了伎俩(使用vim 7.2)。