-
Notifications
You must be signed in to change notification settings - Fork 274
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
When grepping (search rg
), preview could highlight the first match
#1095
Comments
Btw, this is not urgent for me. I was able to add a feature to yazi.nvim where I can read the last yazi-nvim-search.mov |
I'd like to know more about the implementation details:
|
Here is a sample match from // $ rg "window" --files-with-matches --json
{
"type": "match",
"data": {
"path": { "text": "lua/yazi/utils.lua" },
"lines": { "text": "---@param window YaziFloatingWindow\n" },
"line_number": 195,
"absolute_offset": 5224,
"submatches": [{ "match": { "text": "window" }, "start": 10, "end": 16 }],
},
} One possibility would store it as a new struct, composing the existing pub struct RgSearchMatch {
pub file: File,
pub line_number: u32,
}
I don't know what would be the best way to handle this.
To tell you the truth, I would personally be very happy with a super basic implementation in yazi that showed some context around the match. I would give previewer plugins the possibility of doing opt-in fancy things. For example, a plugin could be written that applies a tree-sitter parser (I believe this is the implementation in https://github.com/nvim-telescope/telescope.nvim). |
Looks like rg also provides a rudimentary integration with delta: https://github.com/BurntSushi/ripgrep?tab=readme-ov-file#related-tools I tried this out and it worked.. but some files were not highlighted correctly. Also, this requires a bit of tinkering to set up, so I don't really think it's that good. |
This task is want to make like fg.yazi to a built-in feature? |
Hmm, conceptually they are very similar, but here are some differences:
|
Please describe the problem you're trying to solve
When I search using S (
search rg
), and preview a file that matched my search, the file preview couldWould you be willing to contribute this feature?
Describe the solution you'd like
This is the neovim + telescope implementation
The matched files are displayed on the left, and the preview on the right.
Can it be done the same way? I think it's enough to just display each file once, even if it had multiple matches.
Additional context
Not sure what the performance implications might be.
The text was updated successfully, but these errors were encountered: