How can I highlight a line in the error window by using script?

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

How can I highlight a line in the error window by using script?

张小潘
Hi there,

I am developing some scripts around Vim's error window (a.k.a. quickfix window), such as doing smart thing to open a file other than the default logic of <CR> key.   One nice feature of the <CR> is that it will highlight the selected line in the error window, which I definitely want the script could do.  However, I searched high and low for this and with little success, and I have to simulate a <CR> (through feedkey) or .cc command in the script to achieve the highlight effect.

Does anybody have idea how to highlight a line in error window using script?

Thanks.

--
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: How can I highlight a line in the error window by using script?

Marcin Szamotulski
On 14:50 Thu 08 Sep     , 张小潘 wrote:

> Hi there,
>
> I am developing some scripts around Vim's error window (a.k.a. quickfix
> window), such as doing smart thing to open a file other than the default
> logic of <CR> key.   One nice feature of the <CR> is that it will highlight
> the selected line in the error window, which I definitely want the script
> could do.  However, I searched high and low for this and with little
> success, and I have to simulate a <CR> (through feedkey) or .cc command in
> the script to achieve the highlight effect.
>
> Does anybody have idea how to highlight a line in error window using script?
>
> Thanks.
>
> --
> 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

You can use matchadd() function (see ':help matchadd()'), but you have to
first switch to the quickfix buffer (you can do that using :{widow_nr}wincmd
w, see 'help :wincmd', ':help winnr').

Best regards,
Marcin

--
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: How can I highlight a line in the error window by using script?

Benjamin Fritz
In reply to this post by 张小潘


On Sep 8, 4:50 pm, 张小潘 <[hidden email]> wrote:

> Hi there,
>
> I am developing some scripts around Vim's error window (a.k.a. quickfix
> window), such as doing smart thing to open a file other than the default
> logic of <CR> key.   One nice feature of the <CR> is that it will highlight
> the selected line in the error window, which I definitely want the script
> could do.  However, I searched high and low for this and with little
> success, and I have to simulate a <CR> (through feedkey) or .cc command in
> the script to achieve the highlight effect.
>
> Does anybody have idea how to highlight a line in error window using script?
>

I would say the best way would be to use the :cc command. Is there
some reason you want to avoid this?

--
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