dlo.me

Introspection in Vim

As much as I like my Vim, 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.

Needless to say, I couldn’t stop myself from bringing this functionality to Vim. Here is the finished result:

If pictures aren’t enough, you can also watch a movie if you’re still not convinced :).

Instructions

1. Install snippetsEmu to ~/.vim/plugins/.

2. Download introspection.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.

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<tab> and a snippet will appear. Use <tab> to navigate to the next field.

4. Fork the code on Github and get it working for other languages!