Python Template for Omnicompletion in Vim (tummy.com, ltd. Journal Entry)
tummy.com: we do linux

Tuesday November 29, 2011 at 02:13
Subject: Python Template for Omnicompletion in Vim
Keywords: Omnicomplete, Python, Vim
Posted by: Sean Reifschneider

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
(Post Reply)