ZSH Web Search
November 8, 2024 ยท View on GitHub
A web search plugin for ZSH.
Installation
- Clone this repository to your local machine.
- Add the following line to your
.zshrcfile:
source /path/to/zsh-web-search/zsh-web-search.zsh
- Restart your terminal or source your
.zshrcfile.
Usage
-
To perform a web search, simply type
web_searchfollowed by your search query and press Enter. The plugin will open your default web browser and perform the search using the specified search engine.web_search google zshIf there is no parameter of searching keywords, it will open the homepage of the search engine.
web_search google -
To make it more efficient, you can set aliases for the search engines you use most frequently. For example, you can add the following lines to your
.zshrcorzsh-web-search.zshfile:alias google='web_search google' alias bing='web_search bing'Now, you can use
googleandbingas aliases for the corresponding search engines.google zsh bing zsh
Customization
To add more search engines, you can add them to the zsh-web-search.zsh file. For example, to add the parameter for GitHub, add the entry to this Associative Array:
declare -A search_url_arr=(
...
["github"]="https://github.com/search?q="
...
)
TODO
- Change alias and variables. Prevent from confusing with other shell variables.
- Feature to display all the support search engines.