2

I want vim to run makeprg with two commands, namely: cd\ cmt;make; but when I do so, it get stuck on the make command.

To clarify, when I mean get stuck, I mean that it ends compilation but it doesn't return to vim, I need to strike C-c to cancel compilation, but it also breaks the compilation log interpretation from the compiler, and I can't get the cwin with the compilation errors interpreted.

Any ideas?

  • 1
    What about cd\ cmt\ &&\ make? – romainl Nov 13 '14 at 10:41
  • @romainl yes, thanks! You can post it as an answer. The solution is to use && instead. – Werner Nov 13 '14 at 11:00
  • Just in case if this is an instance of the XY problem. It is possible to run make in an arbitrary directory using -C option. In your case this would be: make -Ccmt. – taketwo Nov 13 '14 at 15:19
7

You should use this form:

set makeprg=cd\ cmt\ &&\ make

If you don't want to escape spaces:

let &makeprg = "cd cmt && make"

--- edit ---

The problem with your initial attempt is that the shell in which makeprg is executed is non-interactive and thus supposed to exit after the execution of a command. Sending it two commands in a row doesn't seem like a good idea.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.