RubenLaguna
RubenLaguna

Reputation: 24806

How can I show filenames in quickfix window as relative path to current (:pwd) directory?

When I run :make with maven the filenames are reported by maven as absolute paths, and the quickfix window will present the absolute path which is much wider that the size of the window.

:set makeprg=mvn\ install
:set errorformat=[%tRROR]\ %f:[%l\\,%c]%m,%-G%.%#
:make

How can I get the quickfix window to show filenames relative to my current directory :pwd?

Upvotes: 1

Views: 433

Answers (1)

RubenLaguna
RubenLaguna

Reputation: 24806

As a workaround it is possible to run :lcd . before :copen. It seems that paths are actually relative to the current directory of the current window and by running :lcd . you make the current directory and the current direction of the current window the same. So when the quickfix window opens it will inherit the "right" current directory.

You don't need to rerun :make for the change to make effect. You can just :cclose the quickfix and lcd . and reopen the quickfix :copen

:set makeprg=mvn\ install
:set errorformat=[%tRROR]\ %f:[%l\\,%c]%m,%-G%.%#
:make
:lcd .
:copen

Upvotes: 2

Related Questions