\%123l and friends -- matching screen line

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

\%123l and friends -- matching screen line

iler.ml

\%23l matches at file line No.23. Ok.
Is there \% that matches the *screen line*, that is,
for example, match to the line that is currently shown at 1st line of
buffer window.

Thanks
Y.L.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: \%123l and friends -- matching screen line

Tony Mechelynck

On 29/03/09 14:03, Yakov wrote:
>
> \%23l matches at file line No.23. Ok.
> Is there \% that matches the *screen line*, that is,
> for example, match to the line that is currently shown at 1st line of
> buffer window.
>
> Thanks
> Y.L.

I don't think there is. That would vary as you scroll.

Similarly, I don't think there is a pattern atom which matches all
positions appearing vertically in the same screen column when lines are
wrapped.


Best regards,
Tony.
--
Reality is bad enough, why should I tell the truth?
                -- Patrick Sky

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: \%123l and friends -- matching screen line

Benjamin Fritz
In reply to this post by iler.ml



On Mar 29, 7:03 am, Yakov <[hidden email]> wrote:

> Is there \% that matches the *screen line*, that is,
> for example, match to the line that is currently shown at 1st line of
> buffer window.
>

You could use line('w0') to get the line number of the first visible
line, then use \%l to match it:

:execute '{first part of command you are using}\%'.line('w0').'l
{second part of command you are using}'

See :help line()

Out of curiosity, what do you need this for?

Is this something for which you could use another match, such as "\
%#" (match cursor position)?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---