Tuesday, May 24, 2011

Re: quick fix to jump between warnings and errors

On 25/05/11 1:46 AM, cyboman wrote:
>
>
> On May 4, 9:10 am, Ben Schmidt<mail_ben_schm...@yahoo.com.au> wrote:
>> On 30/04/11 5:13 AM, cyboman wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> the compiler and lint tool my company is using generate 3 kinds of
>>> messages:errors,warningsand info. right now my keys are mapped in
>>> such a way that inquickfixwindow ijumpbetweenwarnings,errors
>>> and info. is there a way to setup key mappings so that one key would
>>> onlyjumpbetweenerrors, the otherbetweenwarningsand the third
>>> betweeninfo, i.e.
>>
>>> map<F2> jumpto the next error
>>> map<F3> jumpto the next warning
>>> map<F4> jumpto the next info.
>>
>>> here is what my errorformat is set to:
>>
>>> set errorformat=%f\(%l\)\ :\ %m,%C\ \ %p^\,%C%p~,%A\"%f\"\\,%l%m\,%C%m
>>> \,%Z
>>
>>> any help is appreciated.
>>
>> Your errorformat has no %t in it, so it is not detecting error types. So
>> we'll need some way to do that for starters. Can you give some examples
>> of the messages you receive? We can then see whether to integrate a %t
>> into errorformat or use some other appraoch.
>>
>> Either way, I think it should be possible with a little scripting tojumpto the previous/next entry of a certain type.
>>
>> Ben.
>
> sorry for not answering this thread for so long.
> here is the errorformat for the diagnostic messages:
>
> set errorformat=\"%f\"\\,%l%\\s%\\+%t%\\a%\\+\ %n:\ %m " lint error/
> warning/info
> set errorformat+=%A%>%p~ " lint error/warning/info multiline start
> set errorformat+=%C\"%f\"\\,%l%\\s%\\+%t%\\a%\\+\ %n:\ %m,%Z " lint
> multiline later
> set errorformat+=\"%f\"\\,%l%\\s%\\+%t%\\a%\\+%m " compiler error/
> warning/info
> set errorformat+=%A%\\s%\\{2}%>%p^ " compiler error/warning/info
> multiline start
> set errorformat+=%C\"%f\"\\,%l%\\s%\\+%t%\\a%\\+%m,%Z " compiler error/
> warning/info later
> set errorformat+=%t%\\a%\\+%m\(\ %f\ \) " linker error/warning/info
> with a file
>
> how would i jump to errors first, then to warning and then to info
> messages.
>
> any help is appreciated.

See here:

http://groups.google.com/group/vim_use/browse_thread/thread/8c3b287a57e32fda

You should be able to modify my solution there somehow to do what you want, I
think. Refer to :help getqflist() to assist.

Ben.


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: