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 filter ability to picker #232

Merged
merged 1 commit into from
Jun 15, 2021
Merged

Conversation

pickfire
Copy link
Contributor

@pickfire pickfire commented Jun 12, 2021

Inspired by doom emacs. Able to filter picker options multiple times using ctrl-space.

asciicast

| down, ctrl-n | Next entry |
| ctrl-space | Filter options |
| enter | Open selected |
| ctrl-h | Open horizontally |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is assuming we merged the other pull request I sent.

@archseer
Copy link
Member

Quite cool. Is there a way to clear current filters? Does emacs also display currently applied filters somehow?

@pickfire
Copy link
Contributor Author

pickfire commented Jun 12, 2021

Quite cool. Is there a way to clear current filters? Does emacs also display currently applied filters somehow?

Doom emacs does, not sure about emacs. Not sure if there is a way to clear filter. It is not very discoverable for this.

I don't remember where I find this but I believe it's ivy. The behavior is based on shift space to filter, I can't find it in the README.org for ivy though, not sure where I saw this but I use it quite often, not sure how to clear it either. Some other interesting keys that I use quite often.

  • spc ' to resume last search (files, buffer, text search, any search stuff... exact resume)
  • ctrl-space while searching you can preview the file under the text and keep the search up

I can't do shift space for this since helix can't seemed to recognize it. Usually to reset this I will just search again, I wish there is an invert search thing, like just blacklist instead of whitelist but I don't know if such keys exists.

Does emacs also display currently applied filters somehow?

Not sure about emacs again, probably it's ivy in doom emacs. I don't see the filters applied, but even if it does I won't find it useful since I am the one that typed in the filters.

@robinvd
Copy link
Contributor

robinvd commented Jun 12, 2021

That preview keybinding sounds nice. A similar idea could be what they do with https://github.com/nvim-telescope/telescope.nvim. A preview next to the picker

@vv9k
Copy link
Contributor

vv9k commented Jun 13, 2021

Does emacs also display currently applied filters somehow?

Not sure about emacs again, probably it's ivy in doom emacs. I don't see the filters applied, but even if it does I won't find it useful since I am the one that typed in the filters.

Personally I would find it much more convenient to be able to see the filters I entered, especially when looking for something more complex.

@pickfire
Copy link
Contributor Author

That preview keybinding sounds nice. A similar idea could be what they do with https://github.com/nvim-telescope/telescope.nvim. A preview next to the picker

Yeah, no idea how to do that yet. At least it is not annoying enough for me to work on this yet.

Personally I would find it much more convenient to be able to see the filters I entered, especially when looking for something more complex.

The issue is even with a filter it isn't very helpful. Imagine we are doing fuzzy search, so the filter is not an exact filter, searching .md will give results that does not contain .md which could be a typo. That is why I didn't add it now, we could add it later but I don't see a good usecase for fuzzy search. But yeah, in doom emacs there is an option to say if we want fuzzy search or exact search, maybe once we a an exact search runtime option we could have this.

@archseer Is there anything that I need to change for this patch to be merged?

I am thinking maybe later I might change it from shift-space to ctrl-i which means include and ctrl-e which means exclude (or we could have an F1 button to show info box?), I wish there is an exclude because in some cases I want to exclude some stuff.

@archseer
Copy link
Member

There's a conflict in ui/prompt.rs, looks fine otherwise

Inspired by doom emacs. Able to filter picker options multiple times.
@pickfire pickfire merged commit 002f1ad into helix-editor:master Jun 15, 2021
@pickfire pickfire deleted the filter-option branch June 15, 2021 04:04
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.

4 participants