I wish when I edit some source file under a directory, press will trigger cmake and make build, like below:
command -bang -nargs=? Umake call Myfunction(<bang>0)
function! Myfunction(forced)
lcd %:p:h
call system('cmake && make')
endfunction
nmap <F5> :Umake<cr>
This code snippet is copied from internet and did a bit modification, not very sure if it's totally OK. After re-enter vim, Press , the left-bottom command windows shows ":Su" and nothing happened.
(1) Why nothing happened, any syntax issue in Myfunction? (2) Is the line "command -bang" necessary? What's the meaning of 0 here?
Thanks.
<bang>0means either!0which is1or0which check the presence of a bang (i.eUmakeorUmake!)