Word completion & character case & smart case
Is there a way to make vim's word completion smarter with respect to
character cases? Let's consider a buffer like:
Now if I type
vim will present the following possible completions: ab, ac, Ad. But if
I press <c-p> after an upper case A
the possible completions are simply: Ad
Now what I would like to have is:
After a lower case a: ab, ac, ad
After an upper case A: Ab, Ac, Ad
Can this be done somehow by setting some option yet unknown to me?
> Now what I would like to have is:Not to the best of my knowledge as you describe it. However, if
> After a lower case a: ab, ac, ad After an upper case A: Ab,
> Ac, Ad
> Can this be done somehow by setting some option yet unknown to
you turn on the 'ignorecase' setting (":set ic"), you'll get
auto-completion that will change the case of your initial "a", so
if you have your above example, you'll progressively get "ab",
"ac", "Ad", whether you've typed an "a" or an "A".
I fooled around with something like the following mapping, but
didn't have any luck...the <c-p> kept getting interpreted in
Normal mode, rather than in insert mode. Bug? I dunno.
inoremap <c-p> <c-o>:let
"[A-Z]")+1<cr><c-p><c-o>:exec "norm g".(isUpperCase?"U":"u")."iw"<cr>
The mapping wouldn't deal, as it currently stands, with multiple
attempts to use <c-p> to keep reselecting new tries, but that
might be feasible after this.
The above mapping *should*, upon pressing <c-p> in insert mode,
set the variable "isUpperCase" according to the last letter you
typed; then perform a genuine <c-p> (where it's currently
failing); then execute the normal mode command to either do
"gUiw" or "guiw" based on the setting of "isUpperCase". I'd
continue from here, trying to remedy the multiple-tries aspect,
but it's kinda fruitless if I can't get the genuine <c-p> to
Alternatively, if you wanted it based on the first letter of your
word, rather than the most recently typed letter, you can change the
Anybody have any ideas why that <c-p> would be interpreted in
normal mode rather than insert mode?