Help unclear under +cmd

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

Help unclear under +cmd

Tony Mechelynck
Under ":help +cmd" in doc/editing.txt, I think something should be added
or changed to mention that +/pattern positions the cursor, not on the
*first* line matching /pattern/ (from the top of the file), but on the
*next* matching line after wherever the cursor ends up after (at least)
BufReadPost autocommands have been run (I haven't tested BufWinEnter,
but I happen to have a BufReadPost autocommand to recover the latest
known cursor position, see lines 77sqq. of vimrc_example.vim): if the
cursor was previously on the only line matching the pattern, I get a
"search hit BOTTOM, continuing at TOP" message (fleetingly, but recorded
in the message history); that message doesn't appear if I use +1/pattern
instead of just +/pattern .

Best regards,
Tony.
--
"I don't believe in astrology.  But then I'm an Aquarius, and Aquarians
don't believe in astrology."
                -- James R. F. Quirk

--
You received this message from the "vim_dev" 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: Help unclear under +cmd

Andy Wokula
Am 06.06.2010 21:56, schrieb Tony Mechelynck:

> Under ":help +cmd" in doc/editing.txt, I think something should be added
> or changed to mention that +/pattern positions the cursor, not on the
> *first* line matching /pattern/ (from the top of the file), but on the
> *next* matching line after wherever the cursor ends up after (at least)
> BufReadPost autocommands have been run (I haven't tested BufWinEnter,
> but I happen to have a BufReadPost autocommand to recover the latest
> known cursor position, see lines 77sqq. of vimrc_example.vim): if the
> cursor was previously on the only line matching the pattern, I get a
> "search hit BOTTOM, continuing at TOP" message (fleetingly, but recorded
> in the message history); that message doesn't appear if I use +1/pattern
> instead of just +/pattern .

You mean "+0/pattern" instead of "+1/pattern", right?

I'd suggest to turn
     +/{pat} Start at first line containing {pat}.
into
     +0/{pat} Start at first line containing {pat}.

--
Andy

--
You received this message from the "vim_dev" 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: Help unclear under +cmd

Tony Mechelynck
On 07/06/10 15:20, Andy Wokula wrote:

> Am 06.06.2010 21:56, schrieb Tony Mechelynck:
>> Under ":help +cmd" in doc/editing.txt, I think something should be added
>> or changed to mention that +/pattern positions the cursor, not on the
>> *first* line matching /pattern/ (from the top of the file), but on the
>> *next* matching line after wherever the cursor ends up after (at least)
>> BufReadPost autocommands have been run (I haven't tested BufWinEnter,
>> but I happen to have a BufReadPost autocommand to recover the latest
>> known cursor position, see lines 77sqq. of vimrc_example.vim): if the
>> cursor was previously on the only line matching the pattern, I get a
>> "search hit BOTTOM, continuing at TOP" message (fleetingly, but recorded
>> in the message history); that message doesn't appear if I use +1/pattern
>> instead of just +/pattern .
>
> You mean "+0/pattern" instead of "+1/pattern", right?
>
> I'd suggest to turn
> +/{pat} Start at first line containing {pat}.
> into
> +0/{pat} Start at first line containing {pat}.
>

I used +1/pattern/ but the match wasn't on line 1. You're right, it
would skip anything on line 1. +0/pattern/ starts "before" line 1, so if
the match is on line 1 it finds it.

I suppose that +{num} +{pat} and +{num}/{pat} are only particular cases
of +{command}, since an ex-command consisting only of a range is a "go
to line" command, see the paragraph just below ":help gg".


Best regards,
Tony.
--
I am an atheist, thank God!

--
You received this message from the "vim_dev" 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