asyncrun.vim icon indicating copy to clipboard operation
asyncrun.vim copied to clipboard

Missing expansions for makeprg and grepprg

Open raggi opened this issue 8 years ago • 4 comments

Summary: I have some makeprg's that use vim % expansions. I want both :make and :AsyncRun to work consistently. As such I want to continue to use the % style macros. I would like for asyncrun.vim to support makeprg and grepprg that contain % expansions.

When I use :AsyncRun -program=make, I expect the same output as :make, but instead I get, for example package not found %:h. This is because asyncrun#run does not expand % macros.

I have found a partial solution to the same general problem in https://github.com/timbertson/vim-background-make/commit/404905fdf87d00ef05ce72e106cf485d1ed23f3f

I have also locally applied a less complete patch as follows, which covers only my use case (no escaped expansions in my makeprgs), that could also be used as a possible approach: https://gist.github.com/raggi/3bcbb18183be138f3b24718891921d9b

An example of a makeprg I would like to work:

setlocal makeprg=go\ build\ ./%:h;echo\ package\ %:h;echo;go\ test\ ./%:h

And the corresponding errorformat, demonstrating usage:

setlocal errorformat=
      \%E%f:%l::%tarning:\ %m,
      \%E%f:%l:%c:%tarning:\ %m,
      \%E%f:%l::%trror:\ %m,
      \%E%f:%l:%c:%trror:\ %m,
      \%E%f:%l:\ %m,
      \%Dpackage\ %f,
      \%E---\ FAIL:\ %m,
      \%C%f:%l:\ %m

If you would like me to prepare a patch, let me know what your preferred approach will be, and I will add this to my TODO list.

Thanks!

raggi avatar Feb 13 '17 00:02 raggi

Your patch is incorrect, "%" will be expanded automatically by vim in the command line when you press ENTER and before passing to your User Command.

It will be expanded twice in your patch (firstly by vim, secondly by StringReplace).

It must be implemented very carefully by parsing "%" in &makeprg directly.

skywind3000 avatar Feb 13 '17 08:02 skywind3000

I demonstrated otherwise. I wouldn't have been here if it worked! :-)

On Feb 13, 2017 12:22 AM, "Linwei" [email protected] wrote:

Your patch is incorrect, "%" will be expanded automatically by vim in the command line when you press ENTER and before passing to your User Command.

It will be expanded twice in your patch (firstly by vim, secondly by StringReplace).

It must be implemented very carefully by parsing "%" in &makeprg directly.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/skywind3000/asyncrun.vim/issues/35#issuecomment-279321365, or mute the thread https://github.com/notifications/unsubscribe-auth/AAABXCayAQawKjWSQtYPSktA6xFk00W2ks5rcBLbgaJpZM4L-r2r .

raggi avatar Feb 13 '17 18:02 raggi

See also https://github.com/skywind3000/asyncrun.vim/issues/96

Konfekt avatar Apr 13 '18 12:04 Konfekt

Thank @Konfekt , I took his idea and fixed this issue:

see here.

https://github.com/skywind3000/asyncrun.vim/issues/96

skywind3000 avatar Apr 16 '18 08:04 skywind3000