From: Maximilian Friedersdorff Date: Wed, 6 Nov 2019 08:54:54 +0000 (+0000) Subject: Support searching for term X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=67fc4451789b14fbdff3718b986ab472045e746a;p=max%2Fsaltfiles.git Support searching for term --- diff --git a/states/aliases/files/aliases b/states/aliases/files/aliases index ff1500e..413e41e 100644 --- a/states/aliases/files/aliases +++ b/states/aliases/files/aliases @@ -47,4 +47,7 @@ function ssh_in() { ssh -O exit -S \"$control_file\" \"$1\"" } -alias search='w3m duckduckgo.com' +function search() { + quoted=$(python -c "import urllib.parse, sys; print(urllib.parse.quote_plus(' '.join(sys.argv[1:])))" "${@}") + w3m "https://duckduckgo.com/?q=${quoted}" +}