Say I have a python script with a runtime error:
$ cat example.py #! /usr/bin/env python3 a = 1/0
$ python3 example.py Traceback (most recent call last): File "example.py", line 3, in <module> a = 1/0 ZeroDivisionError: division by zero
I want Vim to jump to the problematic line of that file (line 3 in this case). I know Vim can do this because it works just fine for catching errors at compile time in C with
:make and the
Sure, I can populate Vim's quickfix window with
:set makeprg=python3\ % and then
:make, but it does not jump to the line number where the traceback points to. When I look in
:copen it just highlights the first line of the trace, and I can't jump to the relevant line number.
(I'm using Vim 7.4 on Debian
jessie in case that matters.)
My questions are:
Can I configure Vim so that it knows how to get the relevant line number from a Python traceback?
Can I modify the Python interpreter to spit out an error format that Vim already knows how to parse and get the relevant line number?