skywind3000 / asyncrun.vim

:rocket: Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
https://www.vim.org/scripts/script.php?script_id=5431
MIT License
1.84k stars 109 forks source link

-cwd="$(VIM_FILEDIR)" breaks #223

Closed TornaxO7 closed 3 years ago

TornaxO7 commented 3 years ago

Example code (language: C):

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Hi\n");
    return EXIT_SUCCESS;
}

Run with:

:AsyncRun -mode=term -pos=tab -cwd="$(VIM_FILEDIR)" -save=2 gcc -lm % && ./a.out

Getting the following error message: image

It works, if I remove the -cwd="$(VIM_FILEDIR) part of the command.

skywind3000 commented 3 years ago

remove your quotation:

:AsyncRun -mode=term -pos=tab -cwd=$(VIM_FILEDIR) -save=2 gcc -lm % && ./a.out
TornaxO7 commented 3 years ago

It works, thank you!

skywind3000 commented 3 years ago

also I updated asyncrun.vim to mute this error.

skywind3000 commented 3 years ago

I found a bug in your command, % will be interpreted to a file name relative to vim's working directory, if you specify a different directory by -cwd=?, the % should be replaced as `$(VIM_FILENAME)', the correct version is:

:AsyncRun -mode=term -pos=tab -cwd=$(VIM_FILEDIR) -save=2 gcc -lm "$(VIM_FILENAME)" && ./a.out
TornaxO7 commented 3 years ago

I had no problems with this command yet, so I didn't change it but thank you for this hint!