Tomek Wyderka
Tomek Wyderka

Reputation: 1465

display 'make' output in 'vim'

I want to :make and display output from it only if it fails.

I map to

:wa<cr>:make<cr><cr>

and only when it fails I want to see the results. Notice the

<cr><cr> 

sequence, which closes the output because usually it's success and nothing to read. And it's much faster.

Upvotes: 1

Views: 1452

Answers (1)

Peter Rincker
Peter Rincker

Reputation: 45107

You want to use :silent to stop the output and use :cwindow to open the quickfix window when there is something to see.

:wa|silent make|cwindow<cr>

Note: you will want to use <bar> instead of | if this is inside a mapping. Example of a mapping below:

nnoremap <f9> :wa<bar>silent make<bar>cwindow<cr>

See the following for more information:

:h :silent
:h :cw

Upvotes: 1

Related Questions