On Wed, Dec 18, 2024 at 12:06 PM Christian Brabandt <cbli...@256bit.org>
wrote:

>
> On Wed, 18 Dec 2024, Arun E wrote:
>
> > With a buffer having just..
> >
> > aaa
> > bbb
> > aaa
> >
> > ..and with the cursor on the first 'a' on the first line, when you
> search for 'aa', the hit on the first line -- the 'aa' starting at column 2
> -- is not found, rather the cursor lands on the 3rd line. Is this a
> documented behavior? It is
> > the same behaviour in vim 8 and 9. I have not tried other versions.
> >
> > Playing around on it a bit more, I kinda understand why. Vim seems to
> try to match the "aa" in the current position, and avoid the 'a' in column
> 2 for subsequent matches. A zero width pattern seems to hit all
> occurrences (\(aa\)\@=).
> >
>
> Yes, I see the same going back to vim74. Interestingly traditional ex-vi
> behaves the same, while nvi jumps by each single "a" forward (which is
> also confusing: on a line like this:
> aaaaaa
> and then searching for aa and hitting n
> the cursor will move only by a single a forward, while I would expect it
> to move by 2 "a")
>

Ah, I see, thanks for the results on different editors.

Though out of the norm, I like the nvi behavior. Glad to know that vim
also could mimic that.


>
> I checked the POSIX specs, but it doesn't mention anything about it (or
> I did not find it).
>
> > Anyway, the current behavior is very confusing, perhaps should be
> > documented if not done already.
>
> It's hard to find and hard to understand, but :h cpo-c let's you
> configure this.
>

I had a hunch (or maybe I read sometime ago) that it would be in cpo, but
thanks for pointing
out exactly where it is. Though I want that behavior, I will just use that
on a need
basis. I am sure it is going to break many plugins if I turn it on
unconditionally.

Thanks again Christian!

Regards,
-Arun


> Best,
> Christian
> --
> "For the most part, Democrats don't question the Republican's right to
> govern
> when they win elections"
>
> Heck, Democrats don't question the Republican's right to govern even when
> Democrats win elections.
>     -- Moopheus, on scienceblogs.com
>
> --
> --
> 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 received this message because you are subscribed to the Google Groups
> "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_use+unsubscr...@googlegroups.com.
> To view this discussion visit
> https://groups.google.com/d/msgid/vim_use/Z2MrRq/NT2kNOoKA%40256bit.org.
>

-- 
-- 
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 received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_use/CAJUkyiH8dUP1SNPo5GzHb2c878k6rZ3KHZo_bRa%3DWLHdqmPixg%40mail.gmail.com.

Reply via email to