Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing expansions for makeprg and grepprg #35

Open
raggi opened this issue Feb 13, 2017 · 4 comments
Open

Missing expansions for makeprg and grepprg #35

raggi opened this issue Feb 13, 2017 · 4 comments

Comments

@raggi
Copy link

raggi commented Feb 13, 2017

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 timbertson/vim-background-make@404905f

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!

@skywind3000
Copy link
Owner

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.

@raggi
Copy link
Author

raggi commented Feb 13, 2017 via email

@Konfekt
Copy link

Konfekt commented Apr 13, 2018

See also #96

skywind3000 pushed a commit that referenced this issue Apr 16, 2018
2. accept `%` and `$*` macros in makeprg/grepprg
3. close #96 #84 and #35
@skywind3000
Copy link
Owner

skywind3000 commented Apr 16, 2018

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

see here.

#96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants