<C-x><C-o> returns Pattern not found in C/C++ files even with a ctags file.

  • It used to work and I haven't made any configuration/plugin changes that I know of
  • Starting vim with vim -u NONE -U NONE and manually setting omnifunc=ccomplete#Complete results in the same problem (as does vim --clean), so it doesn't seem to be caused by my vim config
  • Python and HTML omnicomplete still works, so the problem seems to be with the tags file
  • <C-]> and <C-x><C-]> still work and complain when the tags file is removed, so the tags file seems to be fine??
  • I'm using Gutentags with Universal-Ctags in Vim 8.2 to automatically generate the tags file (tried a stock Neovim config as well and still the same error)

Any ideas what the problem could be or how I could go about debugging it?

  • it doesn't seem to be caused by my vim config -u NONE results in skipping all plugins and entering compatible mode. No way your plugin-based completion can work under these circumstances. So your test is totally worthless.
    – Matt
    Jul 1, 2020 at 9:37
  • Omnicomplete is a builtin vim feature. Running without vimrc and plugins was to rule those out as causes but thanks for being unnecessarily aggressive I guess?
    – hopibel
    Jul 1, 2020 at 10:18
  • @hopibel you could try the --clean flag; also, ctrl-x ctrl-] should complete tags specifically. You may want to see vi.stackexchange.com/q/2003/10604
    – D. Ben Knoble
    Jul 1, 2020 at 12:49
  • @D.BenKnoble Same result with --clean, unfortunately. And ctrl-x ctrl-] still works for some reason. For whatever bizarre reason, the only thing that doesn't work is ctrl-x ctrl-o with a tags file.
    – hopibel
    Jul 1, 2020 at 13:42

2 Answers 2


This is an old question, but since it is getting bumped without an answer, I will provide an explanation anyway.

The reason <C-x><C-o> (omni-completion) returns "Pattern not found" can be found in the documentation:

CTRL-X CTRL-O           Guess what kind of item is in front of the cursor and
                        find the first match for it

The important word here is Guess. It cannot guess if you haven't typed at least a single letter, which I suspect that's what OP was trying to do.

enter image description here

but it definitely works using a prefix (in this case, the letter "f")

enter image description here

Most other completion functions work by searching, even though the description might lead you to believe that it shouldn't work either. For example,

CTRL-X CTRL-]           Search for the first tag that starts with the same
                        characters as before the cursor. 

Contrary to the most complex omni-complete (see :h complete-functions) which requires a prefix, this type of autocompletion (tag completion) defaults to "show everything" as if nothing was filtered.

enter image description here

However, this doesn't explain why other filetypes seemed to work. As far as I know, other filetypes should work in exactly the same way, unless custom functions are set for the omnifunc option.


In the end I just gave up and installed the clang-complete plugin, which just worked without any fuss. I get the feeling omni-complete may not do what I think it does. The documentation suggests it should be able to complete struct member names but I simply wasn't able to get it to do so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.