created 2002 · complexity basic · author Padraic Renaghan · version 6.0
Put the following into your vimrc, then use
:Make instead of
" Command Make will call make and then cwindow which " opens a 3 line error window if any errors are found. " If no errors, it closes any open cwindow. :command -nargs=* Make make <args> | cwindow 3
Try this mapping so you can just press
\j to make your program:
:map <Leader>j :Make<CR>
You can use the new
:Make command as an extension point for other customizations, too.
Automatically open the quickfix window on :makeEdit
Starting with Vim 7, there's no need for an additional
:Make command; autocmds can be used to hook into the execution of the quickfix command, and open the quickfix window automatically:
" Automatically open, but do not go to (if there are errors) the quickfix / " location list window, or close it when is has become empty. " " Note: Must allow nesting of autocmds to enable any customizations for quickfix " buffers. " Note: Normally, :cwindow jumps to the quickfix window if the command opens it " (but not if it's already open). However, as part of the autocmd, this doesn't " seem to happen. autocmd QuickFixCmdPost [^l]* nested cwindow autocmd QuickFixCmdPost l* nested lwindow
Note that the quickfix window will also automatically close in case the quickfix list becomes empty.
If instead you always want to open the quickfix window, replace the
:cc see the current error :cn next error :cp previous error :clist list all errors