-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Document use of filter columns in pickers #11218
Conversation
Filtering on columns was implemented in helix-editor#9647. The only documentation I could find on this feature was the PR itself, and the video demo used a different syntax.
You can also do multiple filters via syntax like |
Thanks @kirawi! From my testing, it's not |
Hmm, you're right. I was running a build of an older version of the picker PR and it seems to have changed. |
book/src/keymap.md
Outdated
In pickers, you can filter specific columns by prefixing the column name with `%`. | ||
All words after a `%<column>` term are treated as filters for that column. | ||
The base filter is a regex, while column filters are a space-separated of literals. | ||
For example, in the file picker, `init %path api .proto` searches for files containing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of in the file picker
it should probably be in the global search picker
, right? As you cannot search for file contents in the file picker.
Great wording, very helpful and clear. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start but I think we may want a larger section to talk about pickers now. We could add a page under the Usage section like we have for textobjects for example and include some gifs
book/src/keymap.md
Outdated
@@ -452,6 +452,13 @@ Keys to use within picker. Remapping currently not supported. | |||
| `Ctrl-t` | Toggle preview | | |||
| `Escape`, `Ctrl-c` | Close picker | | |||
|
|||
In pickers, you can filter specific columns by prefixing the column name with `%`. | |||
All words after a `%<column>` term are treated as filters for that column. | |||
The base filter is a regex, while column filters are a space-separated of literals. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually columns use fuzzy filtering. There are two exceptions: the default columns for global_search and the LSP workspace_symbol_picker. global_search's default column is a regex and workspace_symbol_picker's is sent to the language server so it can do its own filtering.
Co-authored-by: Michael Davis <[email protected]>
I think I discovered by accident that |
That's not new and been implememted for a long time. That is standard fzf syntax. |
I've moved picker docs to their own section. |
book/src/pickers.md
Outdated
|
||
Most pickers perform fuzzy matching using [fzf syntax](https://github.com/junegunn/fzf?tab=readme-ov-file#search-syntax). Two exceptions are the global search picker, which uses regex, and the workspace symbol picker, which passes search terms to the LSP. | ||
|
||
If a picker shows multiple columns, you may apply the filter to a specific column by prefixing the column name with `%`. Column names can be shortened to any prefix, so `%p`, `%pa` or `%pat` all mean the same as `%path`. For example, `helix %p .toml$ !lang` searches for the term "helix" within files with paths ending in ".toml" but not including "lang". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I thought .toml$
was working, but it isn't. It seems that the line number is considered part of the path, e.g. .toml:7$
works. Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right the line number is considered part of the path
column for the sake of fuzzy matching. So instead of adding $
at the end of a path you can add a :
instead, e.g. %p file.rs:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was in this space recently with #11245 and so added my 2c. Looks good, minor feedback only.
book/src/pickers.md
Outdated
|
||
### Filtering Picker Results | ||
|
||
Most pickers perform fuzzy matching using [fzf syntax](https://github.com/junegunn/fzf?tab=readme-ov-file#search-syntax). Two exceptions are the global search picker, which uses regex, and the workspace symbol picker, which passes search terms to the LSP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an exception to the fzf syntax - the OR syntax is not implemented yet per discussion on #11245
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an issue specifically for OR support? I couldn't find it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I'm aware of either outside of #11245.
Co-authored-by: Michael Davis <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a minor edit, otherwise this is looking good
Co-authored-by: Michael Davis <[email protected]>
Just to double check: For example, a query of helix %p .toml$ !lang in the global search picker searches for the term "helix" within files with paths ending in ".toml" but not including "lang". For me this example doesn't work, because the line numbers in the format of So |
Argh, you're correct @dvic. I meant to correct that but forgot: #11218 (comment).
Personally I think that's the better approach here, but I'm not sure how difficult that is (I can't imagine ever wanting to filter on line number. |
Ahhh I missed that conversation. @the-mikedavis What is your opinion on this? I also think it's not really useful to include the line number in the matching but I don't know how big of an effort it is to exclude this. |
Oh whoops I missed that in review. For now we should update the docs to say |
As discussed in helix-editor#11218 (comment)
* Document use of filter columns in pickers. Filtering on columns was implemented in helix-editor#9647. The only documentation I could find on this feature was the PR itself, and the video demo used a different syntax. * Note that column filters are space-separated. * Note that picker filters can be abbreviated. * Specify correct picker in docs. * Clarify picker filter prefix shortenting. Co-authored-by: Michael Davis <[email protected]> * Move picker docs to their own section. * Update book/src/pickers.md Co-authored-by: Michael Davis <[email protected]> * Improve docs on picker registers, keybinds, and syntax. * Clarify wording around picker queries. Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Ryan Roden-Corrent <[email protected]> Co-authored-by: Michael Davis <[email protected]>
* Document use of filter columns in pickers. Filtering on columns was implemented in helix-editor#9647. The only documentation I could find on this feature was the PR itself, and the video demo used a different syntax. * Note that column filters are space-separated. * Note that picker filters can be abbreviated. * Specify correct picker in docs. * Clarify picker filter prefix shortenting. Co-authored-by: Michael Davis <[email protected]> * Move picker docs to their own section. * Update book/src/pickers.md Co-authored-by: Michael Davis <[email protected]> * Improve docs on picker registers, keybinds, and syntax. * Clarify wording around picker queries. Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Ryan Roden-Corrent <[email protected]> Co-authored-by: Michael Davis <[email protected]>
* Document use of filter columns in pickers. Filtering on columns was implemented in helix-editor#9647. The only documentation I could find on this feature was the PR itself, and the video demo used a different syntax. * Note that column filters are space-separated. * Note that picker filters can be abbreviated. * Specify correct picker in docs. * Clarify picker filter prefix shortenting. Co-authored-by: Michael Davis <[email protected]> * Move picker docs to their own section. * Update book/src/pickers.md Co-authored-by: Michael Davis <[email protected]> * Improve docs on picker registers, keybinds, and syntax. * Clarify wording around picker queries. Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Ryan Roden-Corrent <[email protected]> Co-authored-by: Michael Davis <[email protected]>
* Document use of filter columns in pickers. Filtering on columns was implemented in helix-editor#9647. The only documentation I could find on this feature was the PR itself, and the video demo used a different syntax. * Note that column filters are space-separated. * Note that picker filters can be abbreviated. * Specify correct picker in docs. * Clarify picker filter prefix shortenting. Co-authored-by: Michael Davis <[email protected]> * Move picker docs to their own section. * Update book/src/pickers.md Co-authored-by: Michael Davis <[email protected]> * Improve docs on picker registers, keybinds, and syntax. * Clarify wording around picker queries. Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Ryan Roden-Corrent <[email protected]> Co-authored-by: Michael Davis <[email protected]>
* Document use of filter columns in pickers. Filtering on columns was implemented in helix-editor#9647. The only documentation I could find on this feature was the PR itself, and the video demo used a different syntax. * Note that column filters are space-separated. * Note that picker filters can be abbreviated. * Specify correct picker in docs. * Clarify picker filter prefix shortenting. Co-authored-by: Michael Davis <[email protected]> * Move picker docs to their own section. * Update book/src/pickers.md Co-authored-by: Michael Davis <[email protected]> * Improve docs on picker registers, keybinds, and syntax. * Clarify wording around picker queries. Co-authored-by: Michael Davis <[email protected]> --------- Co-authored-by: Ryan Roden-Corrent <[email protected]> Co-authored-by: Michael Davis <[email protected]>
Filtering on columns was implemented in #9647.
The only documentation I could find on this feature
was the PR itself, and the video demo used a different syntax.