Search code examples
windowsvimautocompleteexuberant-ctags

A new language, how to auto-complete in windows vim?


I'm using Gvim in windows.

Normally, when we type some character then press Ctrl-n, vim will show some tag, but those tags just includes words which have been pre-typed in the current file.

Now, I need it working in a new language, and show the tag which has been defined in other files.

So, I create a new \\.ctags for this new language, and generate tags file by exuberant-ctags. I can choose a function in current file, then press Ctrl-] to jump to the function definition, but this function was define in the other files. It is working very well.

I don't know how to make it show the tags which are generated by ctags when I type some character.

Please help me. Thanks very much.

My English is poor, I hope you can understand what I said.


Solution

  • CTRL-N is just the default completion (which completes from a variety of sources, including the open buffers and also the tags database). There are many more specialized completions (all starting with CTRL-X), among them tags completion, triggered via CTRL-X CTRL-], see :help i_CTRL-X_CTRL-]. If you've correctly configured the 'tags' option (so your tags database is found) and tags jumps do work, just start using that.

    Some languages / filetypes also define a language-specific completion (for language keywords etc.), usually via the 'omnifunc' option and triggered by CTRL-X CTRL-O. You could write such yourself, too.