This commit is contained in:
Alexander Navarro 2023-02-28 23:58:50 -03:00
parent 191c2e4ecd
commit f3c1524c2d
12 changed files with 254 additions and 30 deletions

30
scripts/fzf-nf-icon Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
if [ "$(uname -s)" == "Linux" ]; then
NF_LS_DIR="$HOME/.cache/fzf/nf-ls"
elif [ "$(uname -s)" == "Darwin" ]; then
NF_LS_DIR="/Library/Caches/fzf/nf-ls"
fi
get_nf_cheat_sheets() {
echo -ne "$(
curl -s https://www.nerdfonts.com/cheat-sheet |
grep -o '<div class="class-name">.*</div>' |
sed -e 's/<div class="class-name">\(.*\)<\/div><div title="Copy Hex Code to Clipboard" class="codepoint">\(.*\)<\/div>/\\u\2\tnf-\1/'
)"
}
update_nf-ls_cache() {
get_nf_cheat_sheets >"$NF_LS_DIR"/nf-ls-cheat.sh
}
export -f update_nf-ls_cache
if [ ! -d "$NF_LS_DIR" ]; then
mkdir -p "$NF_LS_DIR"
update_nf-ls_cache
fi
awk '{print $1 " -- " $2}' "$NF_LS_DIR"/nf-ls-cheat.sh | column -t |
fzf -m \
--header "Nerd Font Cheat.sh" \
--bind "enter:execute(wl-copy {+1}; notify-send 'Nerd Font Cheat.sh' '{+1} {+3} - icon has been copied')" \
--bind "alt-u:execute(bash -c update_nf-ls_cache)"