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:

Pneumonoultramicroscopicsilicovolcanoconiosis is a disease which…

And now I'm going to write:

Patients with pneumo

Then <C-n> and bang :-P

share|improve this question
up vote 12 down vote accepted

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

share|improve this answer
    
That's is, thanks Xavier T. – sidyll Feb 14 '11 at 11:39
    
I also added set smartcase to my .vimrc so that text searches retain expected behavior, even with ignorecase in place. – jefe2000 Jun 19 '15 at 0:18
    
I tried this and I'm still only getting upper-case HTML tag completion. – Tanath Jul 13 '15 at 0:12
    
The problem is that ignorecase overrides the default behavior of / to be case-insensitive. – Mahmoud Al-Qudsi Feb 25 at 4:10

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.

share|improve this answer
1  
Looks like I need to review my search process. Anyway, running :ve prints 7.3 for me, so I don't know exactly how to find my Vim version with that precision. This feature is not in my help files. But, after searching over the internet looks like this option was made to turn on case insensitivity on file names completion. Is this right? If so, it's not what I need… – sidyll Feb 13 '11 at 22:40
    
dunno how I read it wrong. Looks like this isn't what you are looking for. – Uku Loskit Feb 13 '11 at 23:15

I don't know about wildignorecase, but

:set ignorecase

does the trick for me (with vim 7.2).

share|improve this answer
    
that's intended to search patterns, right? – sidyll Feb 13 '11 at 22:36
    
@sidyll - right. I guess ignorecase affects the matches found when autocompleting but it's that combination with infercase that gets you where you want, as explained above. That's great, infercase = new to me so I definitely learned something! – tjmw Feb 14 '11 at 13:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.