Vim file paths in quickfix window
vim
Solution
I think this has to do with the `lcd`. When the quickfix window is opened from your function, it will inherit the local-directory from the current window. But when the quickfix window has been opened from anywhere else (or before running your function), it will keep the global working directory. When there's a mismatch, Vim has to display absolute paths.
If you really need to use `:lcd`, it would be better to use a location list (`:lmake`), because that will be local to the window, too. But I would first try to use a global `:cd`, since the switch is only temporary, anyway, and you don't care about restoring the actual original value so far.
Problem
I made a function in Vim that compiles some stuff for me. It looks like so: ``` function! MyFunc(mode) lcd ./build pwd let &makeprg='the_command some_script_file' let &errorformat='some format'.',' let &errorformat.='%-G%.%#' silent make lcd .. cwindow endfunction ``` I usually open vim in a project directory, then I can run this function, which cd's into build, builds it, and cd's back so I stay in my project directory. However, sometimes, when the build fails and brings up the quickfix window, it'll show filenames relative to my project dir (yay), but other times in the same file, it shows the absolute path. The output from the build script always shows relative paths, and vim handles both correctly, i.e. it finds the correct file. I suspect the path handling is responsible. My question is, what's the problem, and is there a better way to handle switching into the build directory and back? I always want relative paths shown. Thanks!!