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 <F9> <F2>:wall<CR>:!clear<CR>:make && !make run<CR>
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 <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
See
:help map_bar
:help :bar
Best regards,
Tony.
--
Every successful person has had failures but repeated failure is no
guarantee of eventual success.