summaryrefslogtreecommitdiff
path: root/.local/bin/fdict
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/fdict')
-rwxr-xr-x.local/bin/fdict25
1 files changed, 25 insertions, 0 deletions
diff --git a/.local/bin/fdict b/.local/bin/fdict
new file mode 100755
index 0000000..8a4ed61
--- /dev/null
+++ b/.local/bin/fdict
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# fzf-dict: get word definitions using sdcv
+
+mkdir -pv ~/.local/share/fzf
+export SDCV_PAGER="less -R"
+
+if [ "$OPENFLAG" = 0 ]; then
+ sdcv --color \
+ -u 'WordNet® 3.0 (En-En)' \
+ -u 'American Heritage Dictionary 4th Ed. (En-En)' \
+ -u 'Urban Dictionary P1 (En-En)' \
+ -u 'Urban Dictionary P2 (En-En)' \
+ "$@"
+ sdcv -u 'Wikipedia English - Free Encyclopedia' "$@" | w3m -T text/html
+ exit
+fi
+
+grep -v \' "${PREFIX:-/usr}/share/dict/words" | fzf \
+ --history "$HOME/.local/share/fzf/word_history" \
+ --header "Startdict Dictionary" --header-first \
+ --preview='OPENFLAG=0 fzf-words {} | fold -sw "$FZF_PREVIEW_COLUMNS"' \
+ --preview-window='nohidden,75%' --tiebreak=begin --print-query \
+ --bind 'alt-enter:execute(OPENFLAG=0 fzf-words {q})' \
+ --bind 'enter:execute(OPENFLAG=0 fzf-words {})'