Re: bind (map) F9 to make && !make run
Hi Tony & Rafal, A.J.Mechelynck wrote: Rafal Maj wrote: A.J.Mechelynck wrote: :map :wall !clear ; make && make run Method II: intermixing internal and external commands :map :wall exe "!clear" exe "make" !make run Note: Method II does not intercept the return status from the first make. Method III (untested) try to fool bash :map :wall exe "!clear" 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 :call MakeAndRun() 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
Re: bind (map) F9 to make && !make run
Rafal Maj wrote: A.J.Mechelynck wrote: :map :wall !clear ; make && make run Method II: intermixing internal and external commands :map :wall exe "!clear" exe "make" !make run Note: Method II does not intercept the return status from the first make. Method III (untested) try to fool bash :map :wall exe "!clear" 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". Please use "Reply to List" or "Reply to All" (whichever is available on your mailer) in preference to "Reply to Sender". Best regards, Tony. -- Contrary to popular belief, Unix is user friendly. It just happens to be selective about who it makes friends with. -- Dave Parnas
Re: bind (map) F9 to make && !make run
Rafal Maj wrote: How to map F9 key to following action: 1. run buildin make (!make) 2. run shell command "make run" I tried: map :wall:!clear:make && !make run but then the F9 key results in: Press ENTER or type command to continue g++ a.cpp -o a.elf -lboost_thread -s -pthread /bin/bash: !make: command not found so the "make" part works, but "!make run " fails... why is it so? What is F2 mapped to? In the following I ignore it. Whatever follows the internal "make" command is passed to bash as parameters, including in this case the exclamation mark. Method I: run external make twice :map :wall !clear ; make && make run Method II: intermixing internal and external commands :map :wall exe "!clear" exe "make" !make run Note: Method II does not intercept the return status from the first make. Method III (untested) try to fool bash :map :wall exe "!clear" make && make run See :help map_bar :help :bar Best regards, Tony. -- Every successful person has had failures but repeated failure is no guarantee of eventual success.
bind (map) F9 to make && !make run
How to map F9 key to following action: 1. run buildin make (!make) 2. run shell command "make run" I tried: map :wall:!clear:make && !make run but then the F9 key results in: Press ENTER or type command to continue g++ a.cpp -o a.elf -lboost_thread -s -pthread /bin/bash: !make: command not found so the "make" part works, but "!make run " fails... why is it so?