At my side the solution was to use silent
more frequently in a command chain.
Specifically before, .vimrc
had:
nnoremap M :silent make\|redraw!\|cc<CR>
This was changed to:
nnoremap M :silent make\|silent redraw!\|silent cc<CR>
Before, the "Press ENTER" not always showed up, but annoyingly often. The additional silent
s fixed this. (It looks like silent
is not needed on redraw!
as :cc
caused the "Press ENTER" message.)
This change has the drawback of no more showing the output of :cc
,
so you have to guess what's the error. A little tweak fixes this:
nnoremap M :silent make\|redraw!\|cw\|silent cc<CR>
This makes the error QuickFix list (Output of make
) automatically
appear (and, by vim-magic, disappear if there is no error).
FYI:
Motivation of this M
-mapping is to just press M
in Normal-Mode to:
- save the edit (when using
make
everything is under git
-control anyway)
- invoke
make
- and directly jump to the first error or warning
My Makefile
s are usually constructed such, that this only takes a fraction of a second.
With a bit of tweaking this can be applied to non-C
type workloads as well:
In .vimrc
add
set efm+=#%t#%f#%l#%c#%m#
This allows vim
to interpret messages like following for :cc
(display error):
#E#file#line#column#message#
#W#file#line#column#message#
#I#file#line#column#message#
(E
rrors, W
arnings, I
nfo, based on vim
magic)
Example how to use this for Python scripts.
(Sorry, no copy here, it's a different story.)