diff --git a/.local/bin/scripts/w4m b/.local/bin/scripts/w4m new file mode 100755 index 0000000..e3eb842 --- /dev/null +++ b/.local/bin/scripts/w4m @@ -0,0 +1,16 @@ +#!/bin/sh + +# Simple w3m wrapper with CLI search engine "support". + +# This script allow to search in DDG or use bangs* from the command line and +# still use full site URLs. +# *In Z Shell you must escape exclamation point with backslash. +# e.g.: `w4m \!gh` or `w4m "how to do xyz"` + +if echo "$1" | grep -q '[a-z|0-9]\.[a-z|0-9]'; then + w3m "$1" +elif [ ! "$1" ]; then + w3m "https://duckduckgo.com/lite" +else + w3m "https://duckduckgo.com/?q=$1" +fi