dlo.me

Introspection in Vim

As much as I like my "Vim":http://www.vim.org, there are times when I want it to be just a little cooler. So in XCode, for example, there's this nice introspection feature that I've been dying to have for a while now. !/images/autocomplete.png! Needless to say, I couldn't stop myself from bringing this functionality to Vim. Here is the finished result: !/images/autocomplete-vim.png! If pictures aren't enough, you can also "watch a movie":http://vimeo.com/13312423 if you're still not convinced :). h2. Instructions 1. Install "snippetsEmu":http://www.vim.org/scripts/script.php?script_id=1318 to @~/.vim/plugins/@. 2. Download "introspection.vim":http://dlo.s3.amazonaws.com/downloads/introspect.vim and also move it to @~/.vim/plugins/@. 3. (optional) Add @autocmd BufEnter *.py call FilterFile()@ to your @.vimrc@. This calls the introspection function whenever you open a buffer containing a Python file. h2. Usage 1. Type up a function. E.g.
def insert_into_db(name, company):
    pass
2. Save the file and type @:edit!@. 3. Now you can type @insert_into_db@ and a snippet will appear. Use @@ to navigate to the next field. 4. "Fork the code on Github":http://github.com/dlo/introspect.vim and get it working for other languages!