Figured I'd drop a note here to ask your opinion before I go implement anything; for context:
My goal is to rig up some fzf vim commands to very quickly search docs without leaving the editor.
I'm imagining running something like this:
hdc $currentWord | rg '^\d+' | fzf --tac | rg '^(\d+)' -or '$1' | hdc
Breaking it down:
hdc $currentWord: Search hoogle for the word under the cursor (or type one myself)
rg '^\d+' use ripgrep to find the list of possible results (all result rows start with a number)
fzf --tac use the fzf fuzzyfinder to interactively select which result I want docs for
rg '^(\d+)' -or '$1' | hdc pull out only the number from the selected line and pass it to hdc to give me the docs.
Currently this doesn't work because hdc loses all of its context in between invocations.
I'm wondering, do you have ideas on how best to solve this? Ideally hdc would have fuzzy-find built-in, but that might be a bit too much to ask, and would only help support this very specific workflow.
Although it's a bit of a hack since it might cause confusion if multiple scripts are running at once, I'm wondering if stashing the context on exit and re-loading it on startup would be a reasonable solution here?
Perhaps a more reasonable solution would be to simply rely on the search being cached and provide a full query as the second search?
Let me know your thoughts, thanks!
Figured I'd drop a note here to ask your opinion before I go implement anything; for context:
My goal is to rig up some fzf vim commands to very quickly search docs without leaving the editor.
I'm imagining running something like this:
Breaking it down:
hdc $currentWord: Search hoogle for the word under the cursor (or type one myself)rg '^\d+'use ripgrep to find the list of possible results (all result rows start with a number)fzf --tacuse the fzf fuzzyfinder to interactively select which result I want docs forrg '^(\d+)' -or '$1' | hdcpull out only the number from the selected line and pass it tohdcto give me the docs.Currently this doesn't work because
hdcloses all of its context in between invocations.I'm wondering, do you have ideas on how best to solve this? Ideally
hdcwould have fuzzy-find built-in, but that might be a bit too much to ask, and would only help support this very specific workflow.Although it's a bit of a hack since it might cause confusion if multiple scripts are running at once, I'm wondering if stashing the context on exit and re-loading it on startup would be a reasonable solution here?
Perhaps a more reasonable solution would be to simply rely on the search being cached and provide a full query as the second search?
Let me know your thoughts, thanks!