From 3e211150ee2f263278737f8124e58ddf70ba6484 Mon Sep 17 00:00:00 2001 From: Tom Schammo Date: Sun, 11 Dec 2022 09:32:45 +0100 Subject: [PATCH 1/5] feat: Add support for brave search --- web_search.plugin.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web_search.plugin.zsh b/web_search.plugin.zsh index a104430..31ff871 100644 --- a/web_search.plugin.zsh +++ b/web_search.plugin.zsh @@ -7,7 +7,7 @@ function web_search() { [[ "$OSTYPE" = linux* ]] && open_cmd='xdg-open' [[ "$OSTYPE" = darwin* ]] && open_cmd='open' - pattern='(google|duckduckgo|bing|yahoo|github|youtube)' + pattern='(google|duckduckgo|bing|yahoo|github|youtube|brave)' # check whether the search engine is supported if [[ $1 =~ pattern ]]; @@ -17,7 +17,7 @@ function web_search() { fi local url - [[ "$1" == 'yahoo' ]] && url="https://search.yahoo.com" || url="https://www.$1.com" + [[ "$1" == 'yahoo' || "$1" == 'brave' ]] && url="https://search.$1.com" || url="https://www.$1.com" # no keyword provided, simply open the search engine homepage if [[ $# -le 1 ]]; then @@ -26,6 +26,7 @@ function web_search() { fi typeset -A search_syntax=( + brave "/search?q=" google "/search?q=" bing "/search?q=" github "/search?q=" @@ -46,6 +47,7 @@ function web_search() { nohup $open_cmd "$url" &> /dev/null } +alias bs='web_search brave' alias bing='web_search bing' alias google='web_search google' alias yahoo='web_search yahoo' From 842dd93e4f2ca0efa2d3d73998e91267aaa59eeb Mon Sep 17 00:00:00 2001 From: Tom Schammo Date: Sun, 11 Dec 2022 09:37:51 +0100 Subject: [PATCH 2/5] docs: Update README Update README to reflect changes in 3e211150ee2f263278737f8124e58ddf70ba6484 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 77d59bc..dbac10a 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ The results are the same for both ways. | alias | engine | | --- | --- | | `ddg` | `https://www.duckduckgo.com/?q=` | +| `bs` | `https://www.search.brave.com/?q=` | | `google` | `https://www.google.com/search?q=` | | `yahoo` | `https://search.yahoo.com/search?p=` | | `github` | `https://github.com/search?q=` | From 0aa1d0659e7ec62d7a0a67cda6ac960b2c844e5f Mon Sep 17 00:00:00 2001 From: Tom Schammo Date: Mon, 6 Nov 2023 14:04:34 +0100 Subject: [PATCH 3/5] refactor: Change alias from `bs` to `brave` for brave-search The binary for the brave browser called `brave-browser`, so there is no conflict with using `brave` for the search. But it is more intuitive than `bs`. --- README.md | 2 +- web_search.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dbac10a..d4c20df 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ The results are the same for both ways. | alias | engine | | --- | --- | | `ddg` | `https://www.duckduckgo.com/?q=` | -| `bs` | `https://www.search.brave.com/?q=` | +| `brave` | `https://www.search.brave.com/?q=` | | `google` | `https://www.google.com/search?q=` | | `yahoo` | `https://search.yahoo.com/search?p=` | | `github` | `https://github.com/search?q=` | diff --git a/web_search.plugin.zsh b/web_search.plugin.zsh index 31ff871..1ecc8ab 100644 --- a/web_search.plugin.zsh +++ b/web_search.plugin.zsh @@ -47,7 +47,7 @@ function web_search() { nohup $open_cmd "$url" &> /dev/null } -alias bs='web_search brave' +alias brave='web_search brave' alias bing='web_search bing' alias google='web_search google' alias yahoo='web_search yahoo' From 183b3f68e428517564d5480c8548b25720a2ea88 Mon Sep 17 00:00:00 2001 From: Tom Schammo Date: Mon, 6 Nov 2023 14:06:41 +0100 Subject: [PATCH 4/5] fix: Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4c20df..bcb31fc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ web-search plugin ----------------- -This plugin allow aliases for searching from terminal with some popular web search engines. +This plugin allows aliases for searching from terminal with some popular web search engines. ## Installation From 642d2d180c550efeaa33270a638e8a32808cf530 Mon Sep 17 00:00:00 2001 From: Tom Schammo Date: Mon, 6 Nov 2023 14:07:47 +0100 Subject: [PATCH 5/5] fix: Fix heading --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bcb31fc..935ff3c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ web-search plugin ----------------- This plugin allows aliases for searching from terminal with some popular web search engines. -## Installation +## Installation ```sh git clone https://github.com/sinetoami/web-search.git "$ZSH_CUSTOM/plugins/web-search"