Suppose I map a key to enter a command in the command buffer, but without hitting enter:
function! BuildSystemTask() if inProject() "generic function that checks if I am in a buildable project :!make<Space> else echom("you are not in a valid project, whatever that means") endif endfunction nnoremap <Leader>b :BuildSystemTask()<CR>
The idea here is that I want to hit my mapping, and I would get "make " in the command buffer so that I can type whatever I want. However, this does not do it because it actually enters the whole command
:!make<Space> as is in the command buffer.
I also tried
:execute "normal! :make<Space>" and that didn't work either. It hits
<CR> at the end.
Any idea how to do this? Or if if there is a better way to invoke a build command (
make is here as an example. It could be
maven). Or if there is a better way to achieve being able to pass arbitrary build command that would be helpful too.