Last Updated: February 27, 2016
· chrismckinnel

Add an abbreviation for IPDB in vim

I find myself using IPDB all the time when I'm debugging either my own, or others' code, after typing it a few times myself I realised how much of a waste of time it was.

Now I have this sweet abbreviation in my vimrc:

ab ip import ipdb; ipdb.set_trace()

So I can type ip<Space> in insert mode, and it will spit out import ipdb; ipdb.set_trace().

Coupled with my save shortcut, I can drop into IPDB in literally about 2 seconds flat from anywhere in my code, which is pretty gravy: ip<Space>jj.