Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n and N after reverse search with ? #470

Closed
xcko opened this issue Jan 21, 2017 · 7 comments
Closed

n and N after reverse search with ? #470

xcko opened this issue Jan 21, 2017 · 7 comments

Comments

@xcko
Copy link
Contributor

xcko commented Jan 21, 2017

After doing a reverse search with ?, n goes to the next forward result, not the next result in reverse.

This is the opposite of vi/vim behaviour.

@aeosynth
Copy link
Contributor

aeosynth commented Jan 21, 2017

The intention is not to be bug for bug compatible with vi(m)

i prefer the vis behavior

@oxalorg
Copy link

oxalorg commented Jan 21, 2017

In my opinion, since the search already wraps around by default, there is no need of ? at all. But maybe I haven't used it enough for it to be of any actual value to me.

@Shugyousha
Copy link
Contributor

Shugyousha commented Jan 21, 2017 via email

@erf
Copy link
Contributor

erf commented Jan 21, 2017

I would prefer it to be consistent with vim. n means to repeat last search, so it should search backwords after ?.

@xcko
Copy link
Contributor Author

xcko commented Jan 21, 2017 via email

@martanne
Copy link
Owner

Like @aeosynth I prefer the current behavior for interactive usage.

I like the fact that n (N) always searches forwards (backwards) irrespective of how the initial search was performed (e.g. *, #, /pattern, ?pattern, :-/pattern :+/pattern etc). There can be times when quite some time passes between the initial search and the need to advance to the next (previous) match. In that case I most likely know whether I want to go forwards or backwards, but not how the initial search was performed.

As far as inconsistencies are concerned gn and gN always operate on the next/previous match irrespective of the initial search direction. So vim is not really self-consistent either.

It could probably be argued that the vim behavior is preferable for non-interactive usage (e.g. macros, mappings etc.) if you want to skip a couple of matches independent of the search direction.

@lafrenierejm
Copy link

@martanne wrote:

As far as inconsistencies are concerned gn and gN always operate on the next/previous match irrespective of the initial search direction. So vim is not really self-consistent either.

As @xcko pointed out, vis is interally inconsistent with how it handles ; and , versus the behavior of repeating searched. This seems undesirable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants