If you are ok with no stdin functionality, you could use this entry in the Vim wikia page.
command! -complete=shellcmd -nargs=+ Shell call RunShellCommand(<q-args>)
function! RunShellCommand(cmdline)
let isfirst = 1
let words = []
for word in split(a:cmdline)
if isfirst
let isfirst = 0
else
if word[0] =~ '\v[%#<]'
let word = expand(word)
endif
let word = shellescape(word, 1)
endif
call add(words, word)
endfor
let expand_cmdline = join(words)
botright new
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
call setline(1, 'You entered: ' . a:cmdline)
call setline(2, 'Expanded to: ' . expand_cmdline)
call append(line('$'), substitute(getline(2), '.', '=', 'g'))
silent execute '$read !'. expand_cmdline
1
endfunction
This command is great for running an autonomous command and getting the response in its own scratch buffer. :RunShellCommand cmake test app Console/CommandFeedParserShell
I use this for all the other non-make situations when I don't want to write the output to my current buffer (a la :!command
).
:silent! make | copen
?