Tuesday, April 27, 2010

Re: A 'visible within the window' range?

On Apr 28, 10:34 am, Tim Chase <v...@tim.thechases.com> wrote:
> On 04/27/2010 06:36 PM, AK wrote:
>
> > On 04/27/2010 07:22 PM, Duane Johnson wrote:
> >> So the % symbol is a special range that means 'the whole file'. Is
> >> there a similar special symbol that means 'what is visible in the
> >> window'?
>
> > HVL
>
> For the uninitiated, that terse 3-character response means
>
>   H    go to the top line displayed on the screen
>   V    go into line-wise visual mode
>   L    go to the last line displayed on the screen

That won't work, though, if you have the 'scrolloff' option set to a
non-zero value.

If you had it set to 5 then 'H' would take you to the 6th line from
the top of the screen and 'L' would take you to the 6th line from the
bottom of the screen.

I'm not sure if there's any simple way to get around that. You could
write some vim script that calls 'H' and then moves the cursor up
'scrolloff' + 1 lines, then calls 'V' then 'L' and then moves the
cursor down 'scrolloff' + 2 lines.

Regards,
James.

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

Post a Comment