From b1186901b70a56f2e34fe320b685950c595b4b01 Mon Sep 17 00:00:00 2001 From: samedamci Date: Mon, 18 May 2020 20:42:36 +0200 Subject: [PATCH] Add 'w4m' wrapper script --- .local/bin/scripts/w4m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 .local/bin/scripts/w4m 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