quick fix to jump between warnings and errors

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

quick fix to jump between warnings and errors

cyboman
the compiler and lint tool my company is using generate 3 kinds of
messages: errors, warnings and info. right now my keys are mapped in
such a way that in quick fix window i jump between warnings, errors
and info. is there a way to setup key mappings so that one key would
only jump between errors, the other between warnings and the third
between info, i.e.

map <F2> jump to the next error
map <F3> jump to the next warning
map <F4> jump to 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.

p.s. i not new to vim but i never really got into all the details. i
didn't come up with errorformat variable setting, my boss gave it to
me. if you could simplify the explanation i would really appreciate it.

--
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
Reply | Threaded
Open this post in threaded view
|

Re: quick fix to jump between warnings and errors

Ben Schmidt
On 30/04/11 5:13 AM, cyboman wrote:

> the compiler and lint tool my company is using generate 3 kinds of
> messages: errors, warnings and info. right now my keys are mapped in
> such a way that in quick fix window i jump between warnings, errors
> and info. is there a way to setup key mappings so that one key would
> only jump between errors, the other between warnings and the third
> between info, i.e.
>
> map<F2>  jump to the next error
> map<F3>  jump to the next warning
> map<F4>  jump to 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 to
jump to the previous/next entry of a certain type.

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
Reply | Threaded
Open this post in threaded view
|

Re: quick fix to jump between warnings and errors

cyboman


On May 4, 9:10 am, Ben Schmidt <[hidden email]> 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.

--
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
Reply | Threaded
Open this post in threaded view
|

Re: quick fix to jump between warnings and errors

Ben Schmidt
On 25/05/11 1:46 AM, cyboman wrote:

>
>
> On May 4, 9:10 am, Ben Schmidt<[hidden email]>  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