Better Python Programming Through vim

I like to use the vim editor for most editing tasks (although not for creative writing). I know, it’s arcane and mysterious (want to quit and save? Just type colon, followed by “w”, followed by “q”, followed by Return. It’s so obvious!), but the first time I saw someone coding productively in it, I was hooked. It only took me 15 years to get to the point where I don’t have to use a cheat-sheet anymore. Here is a config file to help unleash some advanced features and make it easier to use.

I think I code about twice as fast using GVIM as I do using any other editor. My other favorite editor, BBEdit, lost me when they kept asking me to pay for upgrades to keep using the product. After supporting a software product through several generations, it becomes irksome to have to pay just to keep using the product on the latest OS and hardware. Fortunately, vim and the GUI version GVIM are free, open-source products. They are constantly updated to work on the latest operating systems and hardware, and there are versions for every major operating system. This means I get a consistent editing experience whether I’m on Linux, Mac, Solaris, or (ick!) Windows.

I do most of my coding in Python these days, so I have my GVIM set up to make me most efficient for Python coding. I have code autocompletion, highlighting, automatic indentation, and a set of keystrokes that make vim feel more familiar (e.g. Ctrl-s for Save). Here is my gvimrc file, and links to my favorite plugins:

My gvimrc (rename to .gvimrc in your home directory on UNIX): gvimrc

Python indentation: http://www.vim.org/scripts/script.php?script_id=974

Python Omni Completion (autocompletion for Python) http://www.vim.org/scripts/script.php?script_id=1542

Pydiction (works great with Omni Completion): http://www.vim.org/scripts/script.php?script_id=850

Most Recently Used documents: http://www.vim.org/scripts/script.php?script_id=521

Leave a Reply