feat(web-search): add crates.io, docs.rs (#13250)

This commit is contained in:
xusd320 2025-08-07 14:46:00 +08:00 committed by Cheung111
commit f6f2de9b6c
3 changed files with 10 additions and 14 deletions

View file

@ -1,6 +1,6 @@
# direnv plugin # direnv plugin
This plugin creates the [Direnv](https://direnv.net/) hook. This plugin initializes the [Direnv](https://direnv.net/) shell hook for zsh.
To use it, add `direnv` to the plugins array in your zshrc file: To use it, add `direnv` to the plugins array in your zshrc file:
@ -10,6 +10,6 @@ plugins=(... direnv)
## Requirements ## Requirements
In order to make this work, you will need to have the direnv installed. In order to make this work, you will need to have direnv installed and available in your PATH.
More info on the usage and install: https://github.com/direnv/direnv More info on the usage and install: https://github.com/direnv/direnv

View file

@ -4,16 +4,8 @@ if (( ! $+commands[direnv] )); then
return return
fi fi
_direnv_hook() { # Load direnv's shell hook, which is the supported integration mechanism for
trap -- '' SIGINT; # modern direnv versions.
eval "$(direnv export zsh)"; if ! eval "$(direnv hook zsh)"; then
trap - SIGINT; echo "Warning: direnv hook failed to initialize. Please ensure direnv is installed correctly."
}
typeset -ag precmd_functions;
if [[ -z "${precmd_functions[(r)_direnv_hook]+1}" ]]; then
precmd_functions=( _direnv_hook ${precmd_functions[@]} )
fi
typeset -ag chpwd_functions;
if [[ -z "${chpwd_functions[(r)_direnv_hook]+1}" ]]; then
chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
fi fi

View file

@ -37,6 +37,8 @@ function web_search() {
claudeai "https://claude.ai/new?q=" claudeai "https://claude.ai/new?q="
reddit "https://www.reddit.com/search/?q=" reddit "https://www.reddit.com/search/?q="
ppai "https://www.perplexity.ai/search/new?q=" ppai "https://www.perplexity.ai/search/new?q="
rscrate "https://crates.io/search?q="
rsdoc "https://docs.rs/releases/search?query="
) )
# check whether the search engine is supported # check whether the search engine is supported
@ -95,6 +97,8 @@ alias grok='web_search grok'
alias claudeai='web_search claudeai' alias claudeai='web_search claudeai'
alias reddit='web_search reddit' alias reddit='web_search reddit'
alias ppai='web_search ppai' alias ppai='web_search ppai'
alias rscrate='web_search rscrate'
alias rsdoc='web_search rsdoc'
#add your own !bang searches here #add your own !bang searches here
alias wiki='web_search duckduckgo \!w' alias wiki='web_search duckduckgo \!w'