In the normal case, I use the vim make utility. I will install makeprg in the Makefile of the project I am currently working on. Since the project will usually last for weeks or even longer, I donβt need to change the makeprg settings very often. But sometimes I need to write some βfoobarβ code either to practice my C ++ skill, or to prototype some primitive ideas in my mind. Therefore, whenever I switch to the "foobar" mode of using vim, I need to comment on the original makeprg setting, adding a new setting:
au FileType c set makeprg=gcc\ % au FileType cpp set makeprg=g++\ %
which is really very inconvenient. when I get back to the "normal project mode" of using vim, I need to go back to the initial setup. back and forth ....
what i want to know from you guys: is it possible to temporarily set the makeprg parameter. for example, define a function in which the local makeprg value is set first, and then make is called before returning the form, the function call automatically restores makeprg to the value before the function call.
source share