Reputation: 9
I am using vim for competitive programming and I am using this shell script to compile my c++ files.
g++ -static -DLOCAL -lm -s -x c++ -Wall -Wextra -O2 -std=c++17 -o $1 $1.cpp
When I use this script I get all the errors and warnings in the terminal and when I press ENTER everything is gone. Is there a way to modify this script to display errors and warnings in a separate buffer in vim without going to terminal or is there anything that I should add in my .vimrc file ??
I want my vim to show errors like this one below.
Upvotes: 0
Views: 842
Reputation: 9
I fixed the problem by doing this
nnoremap <F9> :wa <bar> :compiler gcc <bar> :silent! make %:r <CR> :cw <CR>
But I don't know how to highlight errors of quickfix list.
Upvotes: 0
Reputation: 891
There are many ways of doing it. The best way, IMHO, would be to use the compiler plugins. Please read :help compiler
. After that please read :help make
. Here is an example from my .vimrc
:
nnoremap <F6> :wa <bar> :compiler cargo <bar> :make build <CR>
The example is for Rust. In your case it would be like this
nnoremap <F6> :wa <bar> :compiler gcc <bar> :make<CR>
Upvotes: 1