aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/fzf-doc
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/fzf-doc')
-rwxr-xr-x.local/bin/fzf-doc44
1 files changed, 0 insertions, 44 deletions
diff --git a/.local/bin/fzf-doc b/.local/bin/fzf-doc
deleted file mode 100755
index 6f51c08..0000000
--- a/.local/bin/fzf-doc
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh -eu
-
-cache=$HOME/.cache/fzf-doc
-documentation=/etc/documentation
-
-fzf_doc_preview() {
- file=$1
- extension=${file##*.}
- case "$extension" in
- md) mdcat -l "$file" ;;
- html) w3m -dump "$file" ;;
- pdf) pdftotext "$file" - ;;
- *) grep -hi -B 10 -A 10 . "${file}" ;;
- esac
-}
-
-if [ ! -f "$cache" ] || test "$cache" -ot "$documentation"; then
- grep -lRi \
- --include=*.md \
- --include=*.txt \
- --include=*.pdf \
- --include=*.html \
- --include=*.yml \
- --include=*.yaml \
- . /etc/documentation > "$cache";
-fi
-
-[ "${1-}" = "--preview" ] && fzf_doc_preview "${2-}" && exit;
-
-grep -i "${1-.}" "$cache" \
- | fzf --preview "fzf-doc --preview {}" \
- | while read -r file
-
-do
- extension=${file##*.}
- case "$extension" in
- md) mdcat -cl "$file" | vim - ;;
- html) w3m -dump "$file" | vim - ;;
- pdf) pdftotext "$file" - | vim - ;;
- yml) vim "$file" ;;
- yaml) vim "$file" ;;
- *) vim "$file" ;;
- esac
-done