in vim, when I use
:make
the output of make is displayed in a “external” window, I don’t like this and I use this map
nnoremap <leader>m :w <bar> make<CR><CR><CR>:copen<CR>
but, in some case the output of make is
make: Nothing to be done for `all'.
how I can add a autoclose to copen when the copen have make: Nothing to be done for all. ?
You can check the contents of the quickfix list via
getqflist(). Then, I would only conditionally open the quickfix window if the first line does not match the text you don’t want to see:The access via
get()avoids errors when the list is empty.You could also always open the list, and then use
:cclosein the conditional, if that better fits your needs.