Mapping <C-X><C-O> to Something More Simple for omni-completion Doesn't Work

56 views
Skip to first unread message

Aram HAVARNEANU

unread,
Dec 9, 2008, 11:41:40 AM12/9/08
to v...@vim.org
Hello,

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

Marc Weber

unread,
Dec 9, 2008, 12:10:46 PM12/9/08
to vim...@googlegroups.com
On Tue, Dec 09, 2008 at 06:41:40PM +0200, Aram HAVARNEANU wrote:
>
> Hello,

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

François Beaubert

unread,
Dec 9, 2008, 12:15:37 PM12/9/08
to vim...@googlegroups.com
>> 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

Aram Havarneanu

unread,
Dec 9, 2008, 12:20:10 PM12/9/08
to vim...@googlegroups.com, marco-...@gmx.de
Marc Weber <marco-...@gmx.de> wrote:

> 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

Aram Havarneanu

unread,
Dec 9, 2008, 12:21:32 PM12/9/08
to vim...@googlegroups.com, francois...@gmail.com
François Beaubert <francois...@gmail.com> wrote:

> 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

Aram Havarneanu

unread,
Dec 9, 2008, 12:48:26 PM12/9/08
to vim...@googlegroups.com, francois...@gmail.com
Aram Havarneanu <ara...@mgk.ro>:

> François Beaubert <francois...@gmail.com> wrote:
>> have you try supertab plugin
>> it may solve your problem : do all your completion with the tab key !
>
> I will try it, thanks.

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

Aram Havarneanu

unread,
Dec 9, 2008, 12:53:41 PM12/9/08
to vim...@googlegroups.com, francois...@gmail.com
Aram Havarneanu <ara...@mgk.ro>:
>> François Beaubert <francois...@gmail.com> wrote:
>>> have you try supertab plugin
>>> it may solve your problem : do all your completion with the tab key !
>>
> 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.

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.

Aram Havarneanu

unread,
Dec 9, 2008, 1:44:26 PM12/9/08
to vim...@googlegroups.com, marco-...@gmx.de
2008/12/9 Aram Havarneanu <ara...@mgk.ro>:

> I have configured completion with:
>
> set completeopt="longest,menuone"

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

Reply all
Reply to author
Forward
0 new messages