Hi Tony & Rafal,

A.J.Mechelynck wrote:
Rafal Maj wrote:

A.J.Mechelynck wrote:

    :map <F9> :wall <Bar> !clear ; make && make run

Method II: intermixing internal and external commands

    :map <F9> :wall <Bar> exe "!clear" <Bar> exe "make" <Bar> !make run

Note: Method II does not intercept the return status from the first make.

Method III (untested) try to fool bash

    :map <F9> :wall <bar> exe "!clear" <Bar> make && make run

Hmm no, I ment to do following:

1. execute vim's command:  make
if the return code is zero (ok) then
2. execute vim's command: !make run

I don't know how to get the return status from the external make invoked by internal ":make".

Try the following (untested) function. I used a function since the commands were getting a bit long to comfortably fit in one line.

fun s:MakeAndRun()
    wall
    !clear
    make
    if !v:shell_error
        !make run
    endif
endfun

nnoremap <F2>  :call <SID>MakeAndRun()<CR>

Note the use of v:shell_error . Hopefully that variable will contain the return status from the make subprocess.

:help v:shell_error

Sorry for the delay in response - I'm not very good at keeping up with my email.

HTH,
Jonathan D Johnston

Reply via email to