Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion web_search.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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|npmjs)'

# check whether the search engine is supported
if [[ $1 =~ pattern ]];
Expand All @@ -32,6 +32,7 @@ function web_search() {
duckduckgo "/?q="
yahoo "/search?p="
youtube "/results?search_query="
npmjs "/search?q="
)

url="${url}${search_syntax[$1]}"
Expand All @@ -52,6 +53,7 @@ alias yahoo='web_search yahoo'
alias ddg='web_search duckduckgo'
alias github='web_search github'
alias youtube='web_search youtube'
alias npmjs='web_search npmjs'

#add your own !bang searches here
alias wiki='web_search duckduckgo \!w'
Expand Down