sunaku/dasht

FZF support

Holzhaus opened this issue · 2 comments

It would be nice to be able to use fzf to select a docset instead of using w3m.

wren commented

Quick hacky alias to use fzf while this issue is being worked on:

alias dasht-search='func() { dasht-query-line $@ | perl -0777 -pe ''s/name = (.*?)\ntype = (.*?)\nfrom = (.*?)\nurl = (.*?)\n/ $4 | $1 | $3 | $3\n\n/g'' | column -ts''|'' | fzf --no-sort --with-nth=2.. --bind ''enter:execute(w3m {1})+accept''; }; func'

Please note that I'm using zsh, so you might have to escape some extra quotes if you are on another shell.

function ffdash() {
    dasht-query-line $@ | perl -0777 -pe 's/name = (.*?)\ntype = (.*?)\nfrom = (.*?)\nurl = (.*?)\n/ $4 | $1 | $3 | $3\n\n/g' | column -ts'|' | fzf --no-sort --with-nth=2.. --bind 'enter:execute(w3m {1})+accept'
}

The above alias in a saner format. It isn't complete though:

❯ dasht-query-line 'wor' | rg word-bre                                                                    
name = word-break
url = file:///Users/evar/.local/share/dasht/docsets/CSS.docset/Contents/Resources/Documents/developer.mozilla.org/en-US/docs/Web/CSS/word-break.html#content

❯ dasht-query-line 'w' | rg word-bre     

dasht-query-line has a limit on the results it returns. I think this should be easy to fix? @sunaku