mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-09-30 06:56:06 +02:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b235c54de |
@@ -1,25 +1,6 @@
|
|||||||
# Git version checking
|
# Git version checking
|
||||||
autoload -Uz is-at-least
|
autoload -Uz is-at-least
|
||||||
# Running `git version` forks on every startup, so cache the result for a day
|
git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
|
||||||
# in $ZSH_CACHE_DIR, keyed on the git command path, mtime, and exec path.
|
|
||||||
() {
|
|
||||||
local cache="$ZSH_CACHE_DIR/git-version" key exec_path
|
|
||||||
local -a stat lines
|
|
||||||
zmodload -F zsh/stat b:zstat
|
|
||||||
zstat -A stat +mtime -- "$commands[git]" 2>/dev/null
|
|
||||||
exec_path="$(git --exec-path 2>/dev/null)"
|
|
||||||
key="$commands[git] $stat[1] $exec_path"
|
|
||||||
|
|
||||||
lines=("$cache"(Nm-1))
|
|
||||||
(( $#lines )) && lines=("${(@f)$(<"$cache")}")
|
|
||||||
if [[ "$lines[1]" = "$key" ]]; then
|
|
||||||
git_version="$lines[2]"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
|
|
||||||
[[ ! -w "$ZSH_CACHE_DIR" ]] || print -rl -- "$key" "$git_version" >| "$cache"
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Functions Current
|
# Functions Current
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ Available search contexts are:
|
|||||||
| `npmpkg` | `https://www.npmjs.com/search?q=` |
|
| `npmpkg` | `https://www.npmjs.com/search?q=` |
|
||||||
| `packagist` | `https://packagist.org/?query=` |
|
| `packagist` | `https://packagist.org/?query=` |
|
||||||
| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
|
| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
|
||||||
|
| `maven` | `https://central.sonatype.com/search?q=` |
|
||||||
|
| `pypi` | `https://pypi.org/search/?q=` |
|
||||||
|
| `aur` | `https://aur.archlinux.org/packages?O=0&K=` |
|
||||||
|
| `archwiki` | `https://wiki.archlinux.org/index.php?search=` |
|
||||||
|
| `wikipedia` | `https://en.wikipedia.org/w/index.php?search=` |
|
||||||
| `chatgpt` | `https://chatgpt.com/?q=` |
|
| `chatgpt` | `https://chatgpt.com/?q=` |
|
||||||
| `claudeai` | `https://claude.ai/new?q=` |
|
| `claudeai` | `https://claude.ai/new?q=` |
|
||||||
| `grokcom` | `https://grok.com/?q=` |
|
| `grokcom` | `https://grok.com/?q=` |
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ function web_search() {
|
|||||||
npmpkg "https://www.npmjs.com/search?q="
|
npmpkg "https://www.npmjs.com/search?q="
|
||||||
packagist "https://packagist.org/?query="
|
packagist "https://packagist.org/?query="
|
||||||
gopkg "https://pkg.go.dev/search?m=package&q="
|
gopkg "https://pkg.go.dev/search?m=package&q="
|
||||||
|
maven "https://central.sonatype.com/search?q="
|
||||||
|
pypi "https://pypi.org/search/?q="
|
||||||
|
aur "https://aur.archlinux.org/packages?O=0&K="
|
||||||
|
archwiki "https://wiki.archlinux.org/index.php?search="
|
||||||
|
wikipedia "https://en.wikipedia.org/w/index.php?search="
|
||||||
chatgpt "https://chatgpt.com/?q="
|
chatgpt "https://chatgpt.com/?q="
|
||||||
grok "https://grok.com/?q="
|
grok "https://grok.com/?q="
|
||||||
claudeai "https://claude.ai/new?q="
|
claudeai "https://claude.ai/new?q="
|
||||||
@@ -92,6 +97,11 @@ alias gems='web_search gems'
|
|||||||
alias npmpkg='web_search npmpkg'
|
alias npmpkg='web_search npmpkg'
|
||||||
alias packagist='web_search packagist'
|
alias packagist='web_search packagist'
|
||||||
alias gopkg='web_search gopkg'
|
alias gopkg='web_search gopkg'
|
||||||
|
alias maven='web_search maven'
|
||||||
|
alias pypi='web_search pypi'
|
||||||
|
alias aur='web_search aur'
|
||||||
|
alias archwiki='web_search archwiki'
|
||||||
|
alias wikipedia='web_search wikipedia'
|
||||||
alias chatgpt='web_search chatgpt'
|
alias chatgpt='web_search chatgpt'
|
||||||
alias grokcom='web_search grok'
|
alias grokcom='web_search grok'
|
||||||
alias claudeai='web_search claudeai'
|
alias claudeai='web_search claudeai'
|
||||||
@@ -116,4 +126,3 @@ if [[ ${#ZSH_WEB_SEARCH_ENGINES} -gt 0 ]]; then
|
|||||||
done
|
done
|
||||||
unset engines key
|
unset engines key
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user