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.71k stars 3.05k forks source link

Use "mini buffer" panel instead of modal, for Search (`Cmd-F`) #4600

Open josdelien opened 1 year ago

josdelien commented 1 year ago

Check for existing issues

Describe the feature

When searching (via Cmd-F) in a document, currently in Zed a search result modal opens with a way to toggle (using unbound < and > icon buttons with the mouse.) The problem with this UI/UX for document search is there's no quick overview, only an indication for the amount of search results found and a way to step over them.

A much faster and more insightful way (see screenshot) I've configured in Emacs Lisp (see screenshot) which I'd like to see implemented in Zed as well:

This way, searching for common keywords (for example fn or struct in Rust, or def in Python) provides a very convenient and quick alternative to visual code folding or a mini-map to provide overview and quick intra-document navigation via keyboard bindings.

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

For example, in this main.rs (Rust) file,

The minibuffer search solution I envision (screenshot: my own Emacs configuration written in Emacs Lisp) for document search/filter... image

... versus what it is now (same document, in Zed) image

josdelien commented 1 year ago

Nota bene: what I've described as my intended default search UX (for Cmd-x), is currently already somewhat implemented in the "Outline View" (Cmd-Shift o) modal, however that Outline view is limited to the LSP and file syntax tree.

==> Ideally I'd want to "merge" the current Search and Outline View functionality as the default Search behaviour, but not restricted to the current Outline View language syntax.

eg:

image

Nota bene: in this specific example, using the search query fn, Outline View happens to work. But let's say I'd for example use multiple comments throughout my code document with the word // TODO: ... this currently won't show in the Outline View.

vikfroberg commented 4 months ago

I've been using this in vim too with fzf. Use it all the time.

Another idea that I've been tinkering with for my setup is to adjust the weight of items depending on the proximity to where the cursor is.