I have vim 7.2.22 on Mac OS X. I have configured (exuberant) ctags and
they work great with omni-completion. I also use the OmniCppComplete
plugin because mainly I work on C++ code.
I want to map the default keybinding for omni-completion to something
more easy to type. I have tried a lot of different options like:
:inoremap <C-O> <C-X><C-O>
:inoremap <C-Space> <C-X><C-O>
:inoremap <C-I> <C-X><C-O>
:inoremap <C-@> <C-X><C-O>
Neither of this works as expected. More specifically, the
omni-completion menu does not pop up. Instead, the shorter keybinding
just inserts the first omni-complete option, so the completion
actually takes place, but it is short circuited because the menu
doesn't show up.
I tested the mappings with:
:imap <keybinding>
and they are ok. I also tested if vim actually receives the key codes
doing in Insert mode:
<C-V><key>
and checking the code. Vim receives the correct keys.
I have same behavior with vim 7.1.145 on FreeBSD.
Is it my fault or have I found a bug?
Thanks,
--
Aram Havarneanu
Hi,
this works for me..
inoremap <c-o> <c-x><c-f>
> Neither of this works as expected. More specifically, the
> omni-completion menu does not pop up. Instead, the shorter keybinding
> just inserts the first omni-complete option, so the completion
> actually takes place, but it is short circuited because the menu
> doesn't show up.
Have you verified that there is more than one completion choice?
Maybe you've set vim completion options to take the first one if there
is no choice?
Marc
have you try supertab plugin
it may solve your problem : do all your completion with the tab key !
regards
> Have you verified that there is more than one completion choice?
> Maybe you've set vim completion options to take the first one if there
> is no choice?
Yes. <C-X><C-O> shows lots of options. The mapping just completes the
first option without showing the menu.
I have configured completion with:
set completeopt="longest,menuone"
So I should see the menu all the time anyway.
--
Aram Hăvărneanu
> have you try supertab plugin
> it may solve your problem : do all your completion with the tab key !
I will try it, thanks.
--
Aram Hăvărneanu
Doesn't work. When I press <Tab>, the text in the bar at the bottom of
the screen toggles from -- INSERT -- to -- (insert) -- amd that's all
it does.
--
Aram Hăvărneanu
I modified the supertab.vim script to do <C-X><C-O> by default and the
behavior is exactly the same as my mappings. It autocompletes with the
first option and no menu is shown.
I must be retarded. Of course the correct setting was:
set completeopt=longest,menuone
Because of that first " I just set it to NULL so the behavior was expected.
Thanks all!
Now it works perfectly.
--
Aram Hăvărneanu