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
49.43k stars 3.01k forks source link

type to search in project panel #17547

Open jtara1 opened 1 month ago

jtara1 commented 1 month 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 2 weeks 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 week 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 week 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 week 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 3 days 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 1 day 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.