zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.91k stars 3.15k forks source link

type to search in project panel #17547

Open jtara1 opened 2 months ago

jtara1 commented 2 months ago

Check for existing issues

Describe the feature

If my focus is on the file explorer/navigator, I should be able to type to start searching by file or folder name to move the selection. Pressing up or down would go to previous or next result from search. Pressing escape would cancel the search leaving selection where it's at.

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

image

ferrao commented 1 month ago

Will this not completely break any configured project panel keymaps @jtara1?

For example, I have a mapped to adding a file, j and k for moving the file selection up and down, etc., all in the goal to be able to use the project panel without leaving the keyboard. With your suggestion, all my keybindings would break.

What I feel is really missing, is the possibility to define a shortcut to search for a file in the project panel.

Coming from NeoVim, I used nvim-tree, where pressing a / is consistent with the vi search command and would find me a file in the file tree, but that is just my preference, the deal breaker here is the non existence of such a keymap.

jtara1 commented 1 month ago

I could settle for using / to search and can appreciate the vim inspired bindings too. Just having the ability to search would be very helpful. I have 100's of directories and 1000's of files in one of my mono repos.

Existing Project Panel key binding options are here https://zed.dev/docs/key-bindings#project-panel

ferrao commented 1 month ago

Existing Project Panel key binding options are here https://zed.dev/docs/key-bindings#project-panel

We have New search in directory option, but it does something different, it just searches across all files for that content and opens them, which is not what we are talking about here.

ferrao commented 1 month ago

Perhaps we should change the name of the issue @jtara1 , to something like "missing keybindings to search for file names in project panel", what do you think?

jtara1 commented 4 weeks ago

Sounds good to me.

What else would this feature include? Navigate to next/previous search result? Exit search mode? Do a new search typing / at any point when focus is in project panel.

Will this be closer to vim where we type / to type to search, focus moves to next result as you type, enter to confirm search, n for next, shift + n for previous, / for new search. Would you exit search mode by pressing escape to be able to get back to your other hotkeys for project panel?

Is it preferred by any to use arrow keys (up/down) to navigate instead of n/shift + n?

Will or does zed have a vim mode that this is tied into or is this independent?

ferrao commented 3 weeks ago

Having a vim mode aware project panel, like we have on the editor, would be great, but just having the possibility to define proper keybindings for search, next search and previous search would suffice to me.