开发者

Case insensitivity on autocomplete

开发者 https://www.devze.com 2023-02-10 11:10 出处:网络
I have searched a lot over the internet and Vim\'s help, so I hope this is not a duplicate question… Anyway:

I have searched a lot over the internet and Vim's help, so I hope this is not a duplicate question… Anyway:

Is there any manner to turn on case insensitivity in Vim's autocomplete feature? I'm not going to use this for coding obviously, but I do write a lot of text in Vim and I miss this for complex and/or long words.

For example, suppose I've written:

Pneumonoultramicro开发者_开发知识库scopicsilicovolcanoconiosis is a disease which…

And now I'm going to write:

Patients with pneumo

Then <C-n> and bang :-P


According to the documentation, it seems you could use the two following options : ignorecase and infercase

  '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.

According to the doc it is working for ins-completion, i.e. automatic completion in insert mode.

You should add the following options in your .vimrc:
set ignorecase
set infercase


Not useful for the use case described in the question, but possibly interesting nevertheless:

: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.

Found it right here on SO :D It's a very novel feature, only since 7.3.072 is it available.


I don't know about wildignorecase, but

:set ignorecase

does the trick for me (with vim 7.2).

0

精彩评论

暂无评论...
验证码 换一张
取 消