]> arthur.barton.de Git - ax-zsh.git/commitdiff
New "websearch" plugin
authorAlexander Barton <alex@barton.de>
Fri, 4 Feb 2022 21:58:38 +0000 (22:58 +0100)
committerAlexander Barton <alex@barton.de>
Fri, 4 Feb 2022 21:58:38 +0000 (22:58 +0100)
plugins/websearch/README.md [new file with mode: 0644]
plugins/websearch/websearch.zshrc [new file with mode: 0644]

diff --git a/plugins/websearch/README.md b/plugins/websearch/README.md
new file mode 100644 (file)
index 0000000..cfc1f53
--- /dev/null
@@ -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 (file)
index 0000000..fb1b76b
--- /dev/null
@@ -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'