To reproduce, create an empty document with a couple of blank lines at
the top, and a non-space character (optionally indented):
$ vim -u NONE
:set wrapscan " should be the default, but just to confirm
:$put=['', 'x']
Now, search for that "first non-space character in the file" (
https://www.reddit.com/r/vim/comments/mvzpq5/how_do_i_jump_to_the_first_non_blank_character_in/ ) with:
/\%^\_s*\S/e
This will correctly find the "x" and land on it.
Using "n" will repeatedly find this same point regardless of where
you are in the document (on the "x" or not on the "x"). Good.
But if you're on the "x", using "N" to search in the reverse
direction fails with
E486: Pattern not found: \%^\_s*\S
If the cursor is elsewhere (not on the "x"), using "N" works, but then
a second "N" will fail because you're now on the "x". It's the same
pattern that was able to be found repeatedly before.
If I initate the search with
?\%^\_s*\S?e
it fails in the same way now with "n" but now "N" works as "n" did
before, leading me to suspect that there's an issue with the
search-forward vs. search-backward aspect, not the n/N aspect.
My expectation is that if I can find something searching forward, I
should be able to find that same thing by searching backward (as long
as 'wrapscan' is set)
Can anybody else confirm?
This is stock-from-packages 8.2.2725 on FreeBSD 13-RELEASE in case
that matters.
-tim
--
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210422093535.28fe5257%40bigbox.attlocal.net.
No comments:
Post a Comment