esac
esac

Reputation: 24695

How to create an autocomplete list in ViM?

As I am typing code, I would like to get the symbol before and after a specific character (e.g. '.' in C#) and pass that to my own program which would then in return give a list of possible completions.

For example if user is typing:

m_Filename.M

I would want to call out into my own DLL/EXE passing "m_Filename" and "M" and my program return a list such as

Match
Matches

And have that popup in a list in ViM for autocompletion suggestions.

Note that this is not asking how to write the DLL/EXE which provides the suggestions, just the functionality in ViM for autocomplete .

Upvotes: 2

Views: 603

Answers (1)

Laurence Gonsalves
Laurence Gonsalves

Reputation: 143314

In vim, see :help 'omnifunc' and :help complete-functions. You can write your own vim function to do completions, and that function can, in turn, invoke an external executable.

Upvotes: 4

Related Questions