Skip to content


Subversion checkout URL

You can clone with
Download ZIP


YCM should query Vim's omnicomplete system if available #3

romainl opened this Issue · 11 comments

6 participants


Currently, YCM seems to only support keyword completion for languages outside the C Family (tested with PHP, JS, CSS and Python). While this completion mechanism may have its merits it is quite dumb. Omni completion generally provides much more useful suggestions. You can compare these two screenshots to get an idea…

image 2013-02-01 a 23 14 19
Omni completion:
image 2013-02-01 a 23 14 27

Additionally, the message in the command-line says "User defined completion" but :set completefunc=javascriptcomplete#CompleteJS (tested to work with <C-x><C-u>) doesn't seem to have any effect whatsoever: only keyword completion is used.

Thanks for your attention.


Yes, I am aware of this; this is why YCM provides an internal Completer API so that semantic completers for other languages can be written.

A generic semantic completer that queries Vim's omni-completion engine but provides YCM's fuzzy filtering and sorting will probably be built.

YCM is barely 1.0 at this point and hopefully will provide great semantic completion for many languages. If you wish to implement some of them, I'd be happy to merge such pull requests.

Thanks for your comments!


Yeah that engine would be the "money maker" for this plugin.


@Valloric It there some hacking guide on how to start implementing own completer? I'm thinking of contribute, but I don't see much info.


@seletskiy Those are docs I've yet to write, but it's coming. :)

For now, take a look in the file. That's basically the API that a Completer subclass needs to implement. See how the file does it.

Let's say you want to write a completer for PHP. You'd create a php folder under the completers folder. You'd write a small file and put in in that folder (see how the other files look, they're like 3 lines of code). Then you'd create a file in your folder and write your completer.

There's still no easy way to have YCM do the sorting and filtering for you, but tomorrow I'll add a function that when provided with a list of completion strings and a user query will returned a filtered and sorted list back.


@Valloric Thanks! I'm will try to dig in soon...


This is now officially implemented as of commit dbad91e! See the updated docs for details, but in short, YCM now uses Vim's omnicomplete data to provide semantic completions for every language Vim has omnicomplete support for.

@Valloric Valloric closed this

@Valloric I'm using it with vimerl, it registers the completefunc and I think YCM uses it correctly when it is automaticaly fired. But then when typing it stops using the completefunc results and switches to fuzzy completion. What I want YCM to do is to continue using only results from completefunc because only that results are semanticaly correct here.



I'm using it with vimerl, it registers the completefunc

It needs to register the omnifunc, not the completefunc. It's also possible you need to add : as a semantic trigger for your language if you haven't already.


Sorry, my mistake, it is omnifunc that is set (to erlang_complete#Complete), not the completefunc. Semantic trigger is also set to ':'.


@tex I'm having the same problem. Did you manage to fix it?


No I didn't. Just gave up. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.