From: Alexander Barton Date: Fri, 4 Feb 2022 21:58:38 +0000 (+0100) Subject: New "websearch" plugin X-Git-Url: https://arthur.ath.cx/gitweb/?a=commitdiff_plain;h=77db1a36e7f165f72a235d331f33d6e3960b8a25;p=ax-zsh.git New "websearch" plugin --- diff --git a/plugins/websearch/README.md b/plugins/websearch/README.md new file mode 100644 index 0000000..cfc1f53 --- /dev/null +++ b/plugins/websearch/README.md @@ -0,0 +1,16 @@ +## websearch + +Setup some functions and aliases to open various search engines (Google, Ecosia, +DuckDuckGo, ...) from the command line. + +### Functions + +- `duckduckgo`: Open DuckDuckGo for the given search terms. +- `ecosia`: Open Ecosia for the given search terms. +- `google`: Open Google for the given search terms. + +### Aliases + +- `ddg`: `duckduckgo` +- `eco`: `ecosia` +- `g0`: `google` diff --git a/plugins/websearch/websearch.zshrc b/plugins/websearch/websearch.zshrc new file mode 100644 index 0000000..fb1b76b --- /dev/null +++ b/plugins/websearch/websearch.zshrc @@ -0,0 +1,23 @@ +# AX-ZSH: Alex' Modular ZSH Configuration +# google.zshrc: Setup functions for using Google in the command line + +# This is an optional plugin. +[[ -z "$AXZSH_PLUGIN_CHECK" ]] || return 92 + +function duckduckgo { + url="https://duckduckgo.com/?q=$@" + open_command "$url" || echo "DuckDuckGo: <$url>" +} +alias ddg='duckduckgo' + +function ecosia { + url="https://www.ecosia.org/search?q=$@" + open_command "$url" || echo "Ecosia: <$url>" +} +alias eco='ecosia' + +function google { + url="https://www.google.de/search?q=$@" + open_command "$url" || echo "Google: <$url>" +} +alias g0='google'