Fuzzy Filter lines in files ( helm-swoop ) #38606
mkcode
started this conversation in
Show and tell
Replies: 1 comment
-
For the interested, achieving the swoop feature with Television (and Nushell): {
"label": "Find in File",
"command": "bat --style=numbers --color=always --theme=TwoDark --paging=never $env.ZED_FILE | tv --ansi --input-header=$\"($env.ZED_RELATIVE_FILE)\" | ansi strip | str trim | split row \" \" | first | zeditor $\"($env.ZED_FILE):($in)\"",
"hide": "always",
"allow_concurrent_runs": true,
"use_new_terminal": true,
"shell": { "program": "nu" }
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Inspired by @baldwindavid in #22581. And following up on the telescope feature request #8279.
I'm sharing 2 tasks I created that both use a combination of fzf and bat. These both work well enough for me in place of a built in telescope in zed.
Swoop is essentially, fuzzy filtering the lines in a file and jumping to it. The name and pattern is inspired by an emacs package - helm-swoop - that I started using over a decade ago. I find the pattern to be more intuitive and faster in general than searching in most cases. This pattern may also go a long way to scratch the itch for the people (myself included) that want either #4930 or #14801. I use the builtin vim sneak functionality for precise movement to the beginning of a word on screen, and then this swoop pattern for larger motions in a file.
In this demo, the first commands are swoop, and the latter are find files.
Here is the
tasks.json
And
keymap.json
Some tips that I've found related to this:
"reveal_target": "center"
works well for an in-window display and"reveal_target": "dock"
works well for the entire window. Conceptually, for in file scoped operations and project scoped operations respectively. This is demoed in the video above.sh
as the shell program makes for faster startup time and minimal latency when using these commands.Open to feedback, improvements and discussion. Hope this helps someone!
Beta Was this translation helpful? Give feedback.
All reactions