mlvzk / manix

A fast CLI documentation searcher for Nix.
Mozilla Public License 2.0
337 stars 19 forks source link

Consider improving highlighting #21

Open gytis-ivaskevicius opened 3 years ago

gytis-ivaskevicius commented 3 years ago

Hey, great project but I have a little suggestion - Implement some sort of type highlighting. This is my current temp workaround:

manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --ansi --preview="manix '{}' | sed 's/type: /> type: /g' | bat -l Markdown --color=always --plain" 

I am just adding the symbol > in front of the type. Seems to get the job done :)

Thanks for this project, and good luck :+1:

blaggacao commented 2 years ago
manix "" | rg -o '^# ([\w.-_'"'"']+)' -r '$1' | awk '!x[\$0]++' | fzf --ansi --preview="manix '{}' | sd 'type: ' '> type: ' | bat -l Markdown --color=always --plain"

addded | awk '!x[\$0]++' for efficient deduplication

manix_hits="^# ([\w.-_']+)"
manix_preview="manix '{}' | sd 'type: ' '> type: ' | bat -l Markdown --color=always --plain"
alias mnix="manix '' | rg -o \"$manix_hits\" -r '\$1' | awk '!x[\$0]++' | fzf --ansi --preview=\"$manix_preview\""