Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Case insensitivity on autocomplete

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

like image 720
sidyll Avatar asked Feb 13 '11 21:02

sidyll


2 Answers

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

like image 172
Xavier T. Avatar answered Oct 18 '22 03:10

Xavier T.


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.

like image 6
Uku Loskit Avatar answered Oct 18 '22 05:10

Uku Loskit