By Sean Reifschneider Date 2011-11-29 02:13 Tags omnicomplete, python, sean reifschneider, vim
Vim Omnicomplete is extremely useful. We use vim for an internal project and have some cases where I wanted to do a custom Omnicomplete, however I'm not really that comfortable with vim's own scripting language. Looking at the existing completion scripts really wasn't helping much either.
What I really wanted to do was build the "omnifunc" completion function in Python. After a few hours of playing, I was able to come up with exactly that and get my completion code working. Now when I press Control-X Control-O I get a menu of my custom completion items, based on project names. It's wonderful!
So I spent a few more hours cleaning it up and making it into a template that hides all the magic and presents (what I hope is) a dead simple structure that a Python programmer can use to make omnicompletion plugins. I've released this template on github as: vim-omnipy-template
comments powered by Disqus