How do I configure Vim to capture PC_Lint's output
I am running Vim on a Windows box and I would like to integrate my use of pc_lint into Vim.开发者_开发技巧 I have figured out how to run lint from within Vim, however I don't know how to grab the output into Vim and ideally how to parse the output so that I can jump to the correct code lines via the error messages.
Does anyone know of a plug-in that will do this? I couldn't find one.
Any advice for this Vim novice?
Cheers, Andrew
I believe you want the :redir
command.
See this link for a good description: http://vim.wikia.com/wiki/Capture_ex_command_output
Actually, here's a much easier way:
:r ! command
That will read the results of command into the current buffer.
OK I got it working.
My efm setting wasn't working correctly.
In my pc_lint config file I have the following setting:
-"format=%(%f %l %C %) %t %n: %m"
And in my vimrc file I have the following setting:
set efm=%f\ \ %l\ \ %c\ \ %m
I also have the following script in my vimrc
" map f4 to run lint
map <f4> :call LintProject()<cr>
"use windows default shell
set shell=cmd.exe
function! LintProject()
new "open a new buffer
exec 'silent r! lint-nt c:\lint\vim\std.lnt *.c -b'
exe "normal ggdd" "remove blank line at the top of the file
caddb "add content of the buffer to the quickfix window
close "close the buffer
copen "open quickfix window
endfunction
Now I can move around the quickfix window as normal and when I press enter I am taken to the file with the error.
Fantastic!!!
精彩评论