I'm trying to lint my C files inside vim. I know that quickfix should help in this case. I found the following pc-lint file maintained by Craig Emery. I have this file in vim/vim80/compiler.
if exists("current_compiler")
finish
endif
let current_compiler = "pc-lint"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=C:\Users\ahmes\PCLint\LIN.bat
CompilerSet errorformat=%A%f(%l\\,%c):\ %t%*[^\ ]\ %n:\ %m,%C%p_,%Z%s,%t%*[\ ]\ %n:\ %m\ (line\ %l\\,\ file\ %f)%*[^`]
When I open quickfix using :copen
after running :make %
and hit enter inside quickfix buffer, the current line is highlighted but it doesn't jump to the error location in the source file.
Another thing is that :cp
and :cn
just jump to the next/previous line in quickfix buffer and not to next/previous error.
I've read this similar question, but this is not my case as is not mapped to anything in my vimrc.
How can I jump to error location inside the source file using quickfix?
UPDATE
I tried playing arround with pc-lint file. I've changed errorformat
to be the following:
CompilerSet errorformat=%f:%m
After running :make %
, the opened source file was closed and a new empty buffer was opened. Then I run :copen
, and the quickfix list opened up and I could navigate between errors using :cn
and :cp
. When I hit enter on an error, the cursor moves to the empty new-opened buffer claiming in the status bar that it is the source file?
By the way, I'm working on a Windows OS.