mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-25 01:47:25 +08:00
Compare commits
5 Commits
b9be3a43b4
...
65a1e4edbe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65a1e4edbe | ||
|
|
c7c0a8917b | ||
|
|
34cd8fbd4a | ||
|
|
08d5c936c6 | ||
|
|
52e848ce8f |
@ -10,7 +10,10 @@ plugins=(... brew)
|
|||||||
|
|
||||||
## Shellenv
|
## Shellenv
|
||||||
|
|
||||||
This plugin also executes `brew shellenv` at plugin load to set up many useful variables, such as `HOMEBREW_PREFIX` or `HOMEBREW_REPOSITORY`.
|
If `brew` is not found in the PATH, this plugin will attempt to find it in common
|
||||||
|
locations, and execute `brew shellenv` to set the environment appropriately.
|
||||||
|
This plugin will also export `HOMEBREW_PREFIX="$(brew --prefix)"` if not previously
|
||||||
|
defined for convenience.
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
|
|||||||
@ -10,18 +10,21 @@ if (( ! $+commands[brew] )); then
|
|||||||
else
|
else
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Only add Homebrew installation to PATH, MANPATH, and INFOPATH if brew is
|
||||||
|
# not already on the path, to prevent duplicate entries. This aligns with
|
||||||
|
# the behavior of the brew installer.sh post-install steps.
|
||||||
|
eval "$("$BREW_LOCATION" shellenv)"
|
||||||
|
unset BREW_LOCATION
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$HOMEBREW_PREFIX" ]]; then
|
if [[ -z "$HOMEBREW_PREFIX" ]]; then
|
||||||
if [[ -z $BREW_LOCATION ]]; then
|
# Maintain compatability with potential custom user profiles, where we had
|
||||||
eval "$(brew shellenv)"
|
# previously relied on always sourcing shellenv. OMZ plugins should not rely
|
||||||
else
|
# on this to be defined due to out of order processing.
|
||||||
eval "$("$BREW_LOCATION" shellenv)"
|
export HOMEBREW_PREFIX="$(brew --prefix)"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset BREW_LOCATION
|
|
||||||
|
|
||||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||||
alias bcubo='brew update && brew outdated --cask'
|
alias bcubo='brew update && brew outdated --cask'
|
||||||
alias brewp='brew pin'
|
alias brewp='brew pin'
|
||||||
|
|||||||
@ -13,12 +13,11 @@ ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖"
|
|||||||
ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔"
|
ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔"
|
||||||
|
|
||||||
function fossil_prompt_info() {
|
function fossil_prompt_info() {
|
||||||
local info=$(fossil branch 2>&1)
|
local branch=$(fossil branch current 2>&1)
|
||||||
|
|
||||||
# if we're not in a fossil repo, don't show anything
|
# if we're not in a fossil repo, don't show anything
|
||||||
! command grep -q "use --repo" <<< "$info" || return
|
! command grep -q "use --repo" <<< "$branch" || return
|
||||||
|
|
||||||
local branch=$(echo $info | grep "* " | sed 's/* //g')
|
|
||||||
local changes=$(fossil changes)
|
local changes=$(fossil changes)
|
||||||
local dirty="$ZSH_THEME_FOSSIL_PROMPT_CLEAN"
|
local dirty="$ZSH_THEME_FOSSIL_PROMPT_CLEAN"
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ function git-fetch-all {
|
|||||||
# Fetch all remotes (avoid ssh passphrase prompt)
|
# Fetch all remotes (avoid ssh passphrase prompt)
|
||||||
date -R &>! "$gitdir/FETCH_LOG"
|
date -R &>! "$gitdir/FETCH_LOG"
|
||||||
GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
|
GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
|
||||||
|
GIT_TERMINAL_PROMPT=0 \
|
||||||
command git fetch --all 2>/dev/null &>> "$gitdir/FETCH_LOG"
|
command git fetch --all 2>/dev/null &>> "$gitdir/FETCH_LOG"
|
||||||
) &|
|
) &|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,9 +25,10 @@ $ google oh-my-zsh
|
|||||||
Available search contexts are:
|
Available search contexts are:
|
||||||
|
|
||||||
| Context | URL |
|
| Context | URL |
|
||||||
|-----------------------|------------------------------------------|
|
| --------------------- | ---------------------------------------- |
|
||||||
| `bing` | `https://www.bing.com/search?q=` |
|
| `bing` | `https://www.bing.com/search?q=` |
|
||||||
| `google` | `https://www.google.com/search?q=` |
|
| `google` | `https://www.google.com/search?q=` |
|
||||||
|
| `brs` or `brave` | `https://search.brave.com/search?q=` |
|
||||||
| `yahoo` | `https://search.yahoo.com/search?p=` |
|
| `yahoo` | `https://search.yahoo.com/search?p=` |
|
||||||
| `ddg` or `duckduckgo` | `https://www.duckduckgo.com/?q=` |
|
| `ddg` or `duckduckgo` | `https://www.duckduckgo.com/?q=` |
|
||||||
| `sp` or `startpage` | `https://www.startpage.com/do/search?q=` |
|
| `sp` or `startpage` | `https://www.startpage.com/do/search?q=` |
|
||||||
|
|||||||
@ -7,22 +7,23 @@ function web_search() {
|
|||||||
typeset -A urls
|
typeset -A urls
|
||||||
urls=(
|
urls=(
|
||||||
$ZSH_WEB_SEARCH_ENGINES
|
$ZSH_WEB_SEARCH_ENGINES
|
||||||
google "https://www.google.com/search?q="
|
google "https://www.google.com/search?q="
|
||||||
bing "https://www.bing.com/search?q="
|
bing "https://www.bing.com/search?q="
|
||||||
yahoo "https://search.yahoo.com/search?p="
|
brave "https://search.brave.com/search?q="
|
||||||
duckduckgo "https://www.duckduckgo.com/?q="
|
yahoo "https://search.yahoo.com/search?p="
|
||||||
startpage "https://www.startpage.com/do/search?q="
|
duckduckgo "https://www.duckduckgo.com/?q="
|
||||||
yandex "https://yandex.ru/yandsearch?text="
|
startpage "https://www.startpage.com/do/search?q="
|
||||||
github "https://github.com/search?q="
|
yandex "https://yandex.ru/yandsearch?text="
|
||||||
baidu "https://www.baidu.com/s?wd="
|
github "https://github.com/search?q="
|
||||||
ecosia "https://www.ecosia.org/search?q="
|
baidu "https://www.baidu.com/s?wd="
|
||||||
goodreads "https://www.goodreads.com/search?q="
|
ecosia "https://www.ecosia.org/search?q="
|
||||||
qwant "https://www.qwant.com/?q="
|
goodreads "https://www.goodreads.com/search?q="
|
||||||
givero "https://www.givero.com/search?q="
|
qwant "https://www.qwant.com/?q="
|
||||||
stackoverflow "https://stackoverflow.com/search?q="
|
givero "https://www.givero.com/search?q="
|
||||||
wolframalpha "https://www.wolframalpha.com/input/?i="
|
stackoverflow "https://stackoverflow.com/search?q="
|
||||||
archive "https://web.archive.org/web/*/"
|
wolframalpha "https://www.wolframalpha.com/input/?i="
|
||||||
scholar "https://scholar.google.com/scholar?q="
|
archive "https://web.archive.org/web/*/"
|
||||||
|
scholar "https://scholar.google.com/scholar?q="
|
||||||
)
|
)
|
||||||
|
|
||||||
# check whether the search engine is supported
|
# check whether the search engine is supported
|
||||||
@ -47,6 +48,7 @@ function web_search() {
|
|||||||
|
|
||||||
|
|
||||||
alias bing='web_search bing'
|
alias bing='web_search bing'
|
||||||
|
alias brs='web_search brave'
|
||||||
alias google='web_search google'
|
alias google='web_search google'
|
||||||
alias yahoo='web_search yahoo'
|
alias yahoo='web_search yahoo'
|
||||||
alias ddg='web_search duckduckgo'
|
alias ddg='web_search duckduckgo'
|
||||||
|
|||||||
@ -273,7 +273,7 @@ setup_ohmyzsh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ostype=$(uname)
|
ostype=$(uname)
|
||||||
if [ -z "${ostype%CYGWIN*}" ] && git --version | grep -q msysgit; then
|
if [ -z "${ostype%CYGWIN*}" ] && git --version | grep -Eq 'msysgit|windows'; then
|
||||||
fmt_error "Windows/MSYS Git is not supported on Cygwin"
|
fmt_error "Windows/MSYS Git is not supported on Cygwin"
|
||||||
fmt_error "Make sure the Cygwin git package is installed and is first on the \$PATH"
|
fmt_error "Make sure the Cygwin git package is installed and is first on the \$PATH"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user