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

Add gB keybinding for finding the previous match #9008

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

musjj
Copy link

@musjj musjj commented Apr 28, 2024

Fix: #9000

What this PR does / why we need it:

gb is a nice binding, so the inverse of it would be useful.

You can bind editor.action.addSelectionToPreviousFindMatch in your config, but the nice thing about the built-in gb is that it aligns all the selection ends of the cursors.

Which issue(s) this PR fixes

fixes #9000

Special notes for your reviewer:

@HenryTSZ
Copy link
Contributor

I merged this PR and tested it locally, and found an issue: When the word are not in current view, It flashed the view to the selected word but jump back to the original one.

prev-find-match.mp4

I discovered the problem through debugging

Vim/src/mode/modeHandler.ts

Lines 1472 to 1475 in 3c33d00

const isLastCursorTracked =
this.vimState.recordedState.actionsRun[
this.vimState.recordedState.actionsRun.length - 1
] instanceof ActionOverrideCmdD;

You need to add ActionPreviousFindMatch here as well

like this:

      const lastActionRun =
        this.vimState.recordedState.actionsRun[this.vimState.recordedState.actionsRun.length - 1];
      const isLastCursorTracked =
        lastActionRun instanceof ActionOverrideCmdD ||
        lastActionRun instanceof ActionPreviousFindMatch;

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

Successfully merging this pull request may close these issues.

Wrong cursor orientation after adding multi-cursor selection
2 participants