Take the 2-minute tour ×

I can parse out the paths to the files of a Python traceback, and I can then send those on to Vim using -p on the command line, so that they are opened one file per tab. So I end up with a command like, for example

vim -p main.py module.py another.py

That opens each file in a new tab, but I would like them opened in a new tab, at the correct line number. So I have tried variations like

vim -p main.py +10 module.py +20 another.py +30

But I cannot seem to get Vim to respect the line numbers I send in on command line - it always just takes the last line number and applies it to first tab. So the example left me in main.py at line 30. Trying variations like

vim -p main.py+10 module.py+20 another.py+30
vim -p main.py\ +10 "module.py +20" another.py@30

all just ended up with bad filenames.

Answers at the level of Python, or Bash command line, or within Vim script, or Vim-Python would all be welcome. Or, indeed, entirely different approaches

(The tracebacks could come from anywhere, and are not necessarily controllable by me. The one that started me off today was just a set of lines in a log from a server.)

share|improve this question
Does this help you (in which case this question is a duplicate)?: Vim: Open multiple files on different lines –  ire_and_curses Jul 4 '12 at 17:10

1 Answer 1

up vote 1 down vote accepted

Try vim plugin: file_line:

vim -p new main.py:10 module.py:20 another.py:30

Known Issue: the first filename should not have a lineno. (I'm trying to figure out WHY...)

share|improve this answer

Your Answer


