Zeioth / rofi-zeal

Use rofi to search documentation on Zeal and Man
MIT License
47 stars 2 forks source link

feat: zeal and man list for fuzzy search/completion #6

Open WillForan opened 1 year ago

WillForan commented 1 year ago

It might be useful to have completions in addition to history

zeal_idx(){ 
 for db in ~/.local/share/Zeal/Zeal/docsets/*.docset/Contents/Resources/docSet.dsidx; do 
 doc=$(perl -lne 'print $1 if m:/([^/]*).docset/:' <<< "$db") # TODO: rm perl depend
 sqlite3 $db 'select name from searchIndex'
done
}
man_idx(){  man -k . | sed 's/^/man /'; }

These are surprisingly fast. together they take about 250ms

hyperfine --style none "zeal_idx >/dev/null" "man_idx >/dev/null" --export-csv >(cat)
command              mean  stddev  median  user  system  min   max
zeal_idx >/dev/null  0.10  0.00    0.10    0.05  0.05    0.10  0.11
man_idx >/dev/null   0.15  0.02    0.14    0.14  0.01    0.13  0.23

I imagine something like

zeal_idx | rofi -dmenu -i  |xarg -r zeal
Zeioth commented 1 year ago

@WillForan if you have a PR I can test I would love to check it out.

I'm gonna release v2 during the next days to address the issues people have found using rofi-zeal during the last couple years. I'm also gonna release a wofi-zeal version for wayland users.