mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-07 06:08:39 +02:00
feat(web-search): add crates.io, docs.rs (#13250)
This commit is contained in:
parent
a6beb0f595
commit
f6f2de9b6c
3 changed files with 10 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# 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:
|
||||
|
||||
|
|
@ -10,6 +10,6 @@ plugins=(... direnv)
|
|||
|
||||
## 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
|
||||
|
|
|
|||
|
|
@ -4,16 +4,8 @@ if (( ! $+commands[direnv] )); then
|
|||
return
|
||||
fi
|
||||
|
||||
_direnv_hook() {
|
||||
trap -- '' SIGINT;
|
||||
eval "$(direnv export zsh)";
|
||||
trap - SIGINT;
|
||||
}
|
||||
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[@]} )
|
||||
# Load direnv's shell hook, which is the supported integration mechanism for
|
||||
# modern direnv versions.
|
||||
if ! eval "$(direnv hook zsh)"; then
|
||||
echo "Warning: direnv hook failed to initialize. Please ensure direnv is installed correctly."
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ function web_search() {
|
|||
claudeai "https://claude.ai/new?q="
|
||||
reddit "https://www.reddit.com/search/?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
|
||||
|
|
@ -95,6 +97,8 @@ alias grok='web_search grok'
|
|||
alias claudeai='web_search claudeai'
|
||||
alias reddit='web_search reddit'
|
||||
alias ppai='web_search ppai'
|
||||
alias rscrate='web_search rscrate'
|
||||
alias rsdoc='web_search rsdoc'
|
||||
|
||||
#add your own !bang searches here
|
||||
alias wiki='web_search duckduckgo \!w'
|
||||
|
|
|
|||
Loading…
Reference in a new issue