I'm trying to use errorformat to shorten the code-compile-code loop. My setup is such:
- MacOS where my editor (vim) sits. Along with git, etc. Everything except the compiler (VCS).
- A Ubuntu VM that runs on the same computer.
- A folder that's shared between the two. It mounts as ~/projects/my_proj on MacOS and /media/psf/projects/my_proj on the VM.
My workflow:
- Edit code on MacOS.
- Send SSH command to VM to compile the code and dump the results in /media/psf/projects/my_proj/results:
ssh remote_user@remote_host cd /media/psf/projects/my_proj/results; vcs <options_string> -f filelist.f
- Examine results of log and edit errors.
In step #3 of the workflow above, I would like to use quickfix to scan the log file. I've found that :cfile works to load the file.
However, the compiler on the VM writes out file paths using the absolute path:
/media/psf/projects/my_proj
When I try to read this into vim on MacOS, /media/psf/projects doesn't exist. And vim cannot display the errors.
What would be the best way (vimscript? macro?) that I can preprocess the log file (replace all folder paths), spit out an intermediate logfile and run :cfile on that?
The signal to noise ratio of your question is low. Here is how I understand your problem:
/media/psf/
in the VM and~/projects/foobar/
in the host,/media/psf/
,/media/psf/
doesn't exist so Vim can't jump to the errors,/media/psf/
to~/projects/foobar/
before or while the error list is fed to Vim.The following solution assumes that the error list retrieved from the VM is saved into a file named
errorfile
at the root of the shared directory:Reference:
FWIW, telling your compiler to write the error list to the file mentioned above would allow you to remove the SSH step from your workflow.