Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When coding I often get errors in a certain line of a certain file. Often the output from compiler or processor has the format filename:LINENUMBER, e.g. /home/math/ Since I use vim I then often copy the path with the trailing colon and linenumber and replace the colon by a space and a '+' character, e.g.: vim /home/math/ +60 in order to open vim with this file at this line. So is there a way I can automate this? And what if filenames have colons inside their names? As I am only interested in Posix systems where colons normally not occur in filenames, I look forward to your suggestions.

share|improve this question
up vote 2 down vote accepted

You don't need to automate this yourself.

vim already has mechanisms to handle jumping to the appropriate source file and line. Either …

  • … write the standard error of your compiler to a temporary file and open vim with that as its quickfix file:
    vim -q errors_file
  • … invoke your compiler from within vim itself using :make, which will automatically use a temporary quickfix file.

There's more on this at :help quickfix.

share|improve this answer

You can compile from inside vim by running :make and then you will be automatically moved to the line.

share|improve this answer
Even if the file is not opened yet? – math Jan 6 '12 at 10:42

If the compiler output is in a vim buffer, you can move the cursor over the filename:linenumber and type gF. Vim will open that file with the cursor at that line. See

:help gF
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .