How can a complete vim script (clang_complete) function, template be executed?

In the clang_complete.txt file (help file), it shows them in clang_complete-compl_kinds:

2.Completion kinds                  *clang_complete-compl_kinds*
Because libclang provides a lot of information about completion, there are
some additional kinds of completion along with standard ones (see >
 :help complete-items for details):

'+' - constructor
'~' - destructor
'e' - enumerator constant
'a' - parameter ('a' from "argument") of a function, method or template
'u' - unknown or buildin type (int, float, ...)
'n' - namespace or its alias
'p' - template ('p' from "pattern")


1. I cannot access the complete elements (this file is not there)
2. Can someone tell me how to use the "+" and "a" parameter, etc. 3.or you can tell me how to show the function parameters when (typed.

(sorry my poor english)


source to share

1 answer

It has been a long time, but I will reply to help future visitors.

I don't quite understand your questions, but I will answer the third one. Clang complete triggers auto suggestion / completion when you write ".", "->" or "::", but you can start it manually.

I use it this way. In this source:

#include <iostream>
using namespace std;

void ExampleFunc (float foo, int &bar)
    cout << foo;

int main (int argc, char **argv)
    int a(0);
    Exa[cursor here]

    return 0;


By writing "Exa" you can click <C-X><C-U>

and you get a preview window with:

Example (float foo, int &bar)


and the completion window (same as when you press <C-N>

(CTRL-N) in insert mode):

Example f void Example(float foo, int &bar)


If there are multiple matches, you can move up or down with <C-N>

or <C-P>

and end with <CR>


Completion is not perfect, but it should work for many other cases, for example (as you mentioned):

#include <vector>
using namespace std;

int main (int argc, char **argv)
    struct MyType {int asdf; float qwer;};
    vector<MyType> vec;
    ve  // suggestions after <C-X><C-U>: 
        //     "vec v vector<MyType> vec" v is for variable
        //     "vector p vector<Typename _Tp>" p is for pattern (template)
        //     constructors with its parameters, etc.

    vec.    // auto-fired suggestions: all std::vector methods
    vec[0]. // auto-fired suggestions: "asdf", "qwer" and MyType methods

    return 0;


If these examples don't work for you, you haven't installed the plugin correctly.

By the way, you can match <C-X><C-U>

with another label.



All Articles