Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added npmjs support #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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