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

Feature: Select all instances for search (Like Sublime's Find All) #6208

Closed
1 task done
selfish opened this issue Jul 11, 2023 · 6 comments · Fixed by #2717
Closed
1 task done

Feature: Select all instances for search (Like Sublime's Find All) #6208

selfish opened this issue Jul 11, 2023 · 6 comments · Fixed by #2717
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label]

Comments

@selfish
Copy link

selfish commented Jul 11, 2023

Check for existing issues

  • Completed

Describe the feature

When searching (buffer), I'd like to be able to define a hotkey for selecting all instances of the search string.

In Sublime, you would Cmd+f, type something in, then Alt+Enter or (click the "Find All" button) to select all results.

A selection (with a marker at the end of it) would then be placed on every match in the document.

This aligns with the current supported:

Select next match: Enter
Select prev match: Shift+Enter

Suggested:
Select all matches: Alt+Enter

Thank you

If applicable, add mockups / screenshots to help present your vision of the feature

Keymap.json example:

[
  {
    "context": "BufferSearchBar",
    "bindings": {
      "alt+enter": "buffer:search:selectAllMatches"   // ← This is new
    }
  }
]
@selfish selfish added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Jul 11, 2023
@JosephTLyons
Copy link
Contributor

Hey @selfish, does this issue cover your request?

@JosephTLyons JosephTLyons added editor Feedback for code editing, formatting, editor iterations, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Jul 11, 2023
SomeoneToIgnore referenced this issue Jul 14, 2023
Closes https://github.com/zed-industries/community/issues/75
Closes https://github.com/zed-industries/community/issues/1749

The PR 

* changes keybindings for `Editor && mode == auto_height` context:
before, `alt-enter` and `alt-shift-enter` added new lines in such
editors, including the one from buffer search.

New bindings are the same as in `Editor && mode == full` context.

* adds `search::SelectAllMatches` action and binds it to `Alt + Enter`
by default, to select all matches of a buffer search

The behavior mimics VSCode: we do not move the screen even if all
selections are out of the visible range (Cmd+G will navigate there) and
allow reselecting the results from both pane and search field, as long
as the search is not dismissed.

Release Notes:

- Added `search::SelectAllMatches` (`Alt + Enter` default) action to
place carets and select all buffer search results
([#75](https://github.com/zed-industries/community/issues/75),
[#1749](https://github.com/zed-industries/community/issues/1749)).
@SomeoneToIgnore
Copy link
Contributor

This comes with the 0.96.0 version.

@joeldrapper
Copy link

Will this eventually be applied to the project-wide search? Should we open another issue for that?

@SomeoneToIgnore
Copy link
Contributor

This action is valid in the context of a single buffer search only (since interacts with cmd+g and other related keybindings), and project search is a multibuffer that does not have such search, neither I am aware of any close future plans to add one.

#5448 could help, though: cmd+d to select next selection works in project-wide search and any other multibuffer, so whatever enhances it to select every match should work with it too.
Would that functionality help?

@joeldrapper
Copy link

@SomeoneToIgnore that would definitely help. Alternatively, some kind of find and global find and replace feature would be ideal, especially if the replacement could include regex captures.

@selfish
Copy link
Author

selfish commented Jul 23, 2023

Sorry for the slow response here; it's great to hear that!
Thank you!

@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants