mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-07-06 10:18:25 +00:00
Compare commits
8 Commits
c86ba78e2f
...
rr-13813-i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84429a7229 | ||
|
|
5181447da8 | ||
|
|
c954bbb168 | ||
|
|
630a7c04c3 | ||
|
|
e25f96735e | ||
|
|
70ad5e3df8 | ||
|
|
b86a99da17 | ||
|
|
cfdc4822d4 |
2
.github/workflows/dependencies.yml
vendored
2
.github/workflows/dependencies.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Authenticate as @ohmyzsh
|
- name: Authenticate as @ohmyzsh
|
||||||
|
|||||||
6
.github/workflows/dependencies/updater.py
vendored
6
.github/workflows/dependencies/updater.py
vendored
@@ -348,7 +348,7 @@ class Git:
|
|||||||
default_branch = "master"
|
default_branch = "master"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clone(remote_url: str, branch: str, repo_dir: str, reclone=False):
|
def clone(remote_url: str, ref: str, repo_dir: str, reclone=False):
|
||||||
# If repo needs to be fresh
|
# If repo needs to be fresh
|
||||||
if reclone and os.path.exists(repo_dir):
|
if reclone and os.path.exists(repo_dir):
|
||||||
shutil.rmtree(repo_dir)
|
shutil.rmtree(repo_dir)
|
||||||
@@ -356,11 +356,11 @@ class Git:
|
|||||||
# Clone repo in tmp directory and checkout branch
|
# Clone repo in tmp directory and checkout branch
|
||||||
if not os.path.exists(repo_dir):
|
if not os.path.exists(repo_dir):
|
||||||
print(
|
print(
|
||||||
f"Cloning {remote_url} to {repo_dir} and checking out {branch}",
|
f"Cloning {remote_url} to {repo_dir} and checking out {ref}",
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
)
|
)
|
||||||
CommandRunner.run_or_fail(
|
CommandRunner.run_or_fail(
|
||||||
["git", "clone", "--depth=1", "-b", branch, remote_url, repo_dir],
|
["git", "clone", "--depth=1", "--revision", ref, remote_url, repo_dir],
|
||||||
stage="Clone",
|
stage="Clone",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
4
.github/workflows/installer.yml
vendored
4
.github/workflows/installer.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Set up git repository
|
- name: Set up git repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
- name: Install zsh
|
- name: Install zsh
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: sudo apt-get update; sudo apt-get install zsh
|
run: sudo apt-get update; sudo apt-get install zsh
|
||||||
@@ -52,7 +52,7 @@ jobs:
|
|||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
- name: Install Vercel CLI
|
- name: Install Vercel CLI
|
||||||
run: npm install -g vercel
|
run: npm install -g vercel
|
||||||
- name: Setup project and deploy
|
- name: Setup project and deploy
|
||||||
|
|||||||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
|||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: Set up git repository
|
- name: Set up git repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
- name: Install zsh
|
- name: Install zsh
|
||||||
run: sudo apt-get update; sudo apt-get install zsh
|
run: sudo apt-get update; sudo apt-get install zsh
|
||||||
- name: Check syntax
|
- name: Check syntax
|
||||||
|
|||||||
4
.github/workflows/scorecard.yml
vendored
4
.github/workflows/scorecard.yml
vendored
@@ -41,7 +41,7 @@ jobs:
|
|||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
- name: "Checkout code"
|
- name: "Checkout code"
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@@ -60,6 +60,6 @@ jobs:
|
|||||||
retention-days: 5
|
retention-days: 5
|
||||||
|
|
||||||
- name: "Upload to code-scanning"
|
- name: "Upload to code-scanning"
|
||||||
uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
|
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
sarif_file: results.sarif
|
||||||
|
|||||||
@@ -466,6 +466,15 @@ zstyle ':omz:update' frequency 7
|
|||||||
zstyle ':omz:update' frequency 0
|
zstyle ':omz:update' frequency 0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
By default, updates always pull the latest changes. If you'd rather let others kick the tires first
|
||||||
|
before an update reaches your machine, you can set a cooldown (in days). You'll still get everything —
|
||||||
|
just a little later:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Only apply updates that are at least 10 days old
|
||||||
|
zstyle ':omz:update' cooldown 10
|
||||||
|
```
|
||||||
|
|
||||||
### Updates Verbosity
|
### Updates Verbosity
|
||||||
|
|
||||||
You can also limit the update verbosity with the following settings:
|
You can also limit the update verbosity with the following settings:
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ If `brew` is not found in the PATH, this plugin will attempt to find it in commo
|
|||||||
In case you installed `brew` in a non-common location, you can still set `BREW_LOCATION` variable pointing to
|
In case you installed `brew` in a non-common location, you can still set `BREW_LOCATION` variable pointing to
|
||||||
the `brew` binary before sourcing `oh-my-zsh.sh` and it'll set up the environment.
|
the `brew` binary before sourcing `oh-my-zsh.sh` and it'll set up the environment.
|
||||||
|
|
||||||
|
### sbin directory
|
||||||
|
|
||||||
|
This plugin also adds `$HOMEBREW_PREFIX/sbin` to the PATH if the directory exists and isn't already present.
|
||||||
|
Some Homebrew formulae (e.g. `mtr`) install executables to `sbin`, which `brew doctor` checks for. This
|
||||||
|
ensures the `bdr` alias runs without warnings.
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|
|||||||
@@ -30,6 +30,16 @@ if [[ -z "$HOMEBREW_PREFIX" ]]; then
|
|||||||
export HOMEBREW_PREFIX="$(brew --prefix)"
|
export HOMEBREW_PREFIX="$(brew --prefix)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Add Homebrew sbin to PATH if it exists and is not already in PATH.
|
||||||
|
# Homebrew's shellenv only adds bin directories, not sbin. Some formulae
|
||||||
|
# (e.g. mtr) install executables to sbin, and brew doctor warns if it's
|
||||||
|
# missing from PATH.
|
||||||
|
if [[ -d "$HOMEBREW_PREFIX/sbin" ]]; then
|
||||||
|
if [[ ! "$PATH" == *"$HOMEBREW_PREFIX/sbin"* ]]; then
|
||||||
|
export PATH="$HOMEBREW_PREFIX/sbin:$PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
|
if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
|
||||||
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
|
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ This plugin sets up completion and aliases for [Deno](https://deno.land).
|
|||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Full command |
|
| Alias | Full command |
|
||||||
| ----- | ------------------- |
|
| ----- | ---------------- |
|
||||||
| db | deno bundle |
|
| dc | deno compile |
|
||||||
| dc | deno compile |
|
| dca | deno cache |
|
||||||
| dca | deno cache |
|
| dck | deno check |
|
||||||
| dfmt | deno fmt |
|
| dfmt | deno fmt |
|
||||||
| dh | deno help |
|
| dh | deno help |
|
||||||
| dli | deno lint |
|
| dli | deno lint |
|
||||||
| drn | deno run |
|
| drn | deno run |
|
||||||
| drA | deno run -A |
|
| drA | deno run -A |
|
||||||
| drw | deno run --watch |
|
| drw | deno run --watch |
|
||||||
| dru | deno run --unstable |
|
| dsv | deno serve |
|
||||||
| dts | deno test |
|
| dts | deno test |
|
||||||
| dup | deno upgrade |
|
| dup | deno upgrade |
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# ALIASES
|
# ALIASES
|
||||||
alias db='deno bundle'
|
|
||||||
alias dc='deno compile'
|
alias dc='deno compile'
|
||||||
alias dca='deno cache'
|
alias dca='deno cache'
|
||||||
|
alias dck='deno check'
|
||||||
alias dfmt='deno fmt'
|
alias dfmt='deno fmt'
|
||||||
alias dh='deno help'
|
alias dh='deno help'
|
||||||
alias dli='deno lint'
|
alias dli='deno lint'
|
||||||
alias drn='deno run'
|
alias drn='deno run'
|
||||||
alias drA='deno run -A'
|
alias drA='deno run -A'
|
||||||
alias drw='deno run --watch'
|
alias drw='deno run --watch'
|
||||||
alias dru='deno run --unstable'
|
alias dsv='deno serve'
|
||||||
alias dts='deno test'
|
alias dts='deno test'
|
||||||
alias dup='deno upgrade'
|
alias dup='deno upgrade'
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,52 @@ __go_identifiers() {
|
|||||||
compadd $(godoc -templates "$tmpl_path" ${words[-2]} 2> /dev/null)
|
compadd $(godoc -templates "$tmpl_path" ${words[-2]} 2> /dev/null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__go_tool_commands() {
|
||||||
|
local -a tools tool_commands
|
||||||
|
local -A command_seen short_count
|
||||||
|
local tool command
|
||||||
|
|
||||||
|
tools=("${(@f)$(go tool 2>/dev/null)}")
|
||||||
|
|
||||||
|
# Go 1.24+ lists module tools by package path, but also accepts unique
|
||||||
|
# default binary names for those tools.
|
||||||
|
for tool in "${tools[@]}"; do
|
||||||
|
[[ -n $tool ]] || continue
|
||||||
|
|
||||||
|
(( command_seen[$tool]++ ))
|
||||||
|
|
||||||
|
if [[ $tool == */* ]]; then
|
||||||
|
command=${tool:t}
|
||||||
|
|
||||||
|
if [[ $command == v[0-9]* && ${command#v} != *[^0-9]* ]] && (( ${command#v} > 1 )); then
|
||||||
|
command=${${tool%/$command}:t}
|
||||||
|
fi
|
||||||
|
|
||||||
|
(( short_count[$command]++ ))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for tool in "${tools[@]}"; do
|
||||||
|
[[ -n $tool ]] || continue
|
||||||
|
|
||||||
|
tool_commands+=("$tool")
|
||||||
|
|
||||||
|
if [[ $tool == */* ]]; then
|
||||||
|
command=${tool:t}
|
||||||
|
|
||||||
|
if [[ $command == v[0-9]* && ${command#v} != *[^0-9]* ]] && (( ${command#v} > 1 )); then
|
||||||
|
command=${${tool%/$command}:t}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( short_count[$command] == 1 && ! command_seen[$command] )); then
|
||||||
|
tool_commands+=("$command")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
_values "go tool" "${tool_commands[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
_go() {
|
_go() {
|
||||||
typeset -a commands build_flags
|
typeset -a commands build_flags
|
||||||
commands+=(
|
commands+=(
|
||||||
@@ -208,7 +254,7 @@ _go() {
|
|||||||
;;
|
;;
|
||||||
tool)
|
tool)
|
||||||
if (( CURRENT == 3 )); then
|
if (( CURRENT == 3 )); then
|
||||||
_values "go tool" $(go tool)
|
__go_tool_commands
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
case ${words[3]} in
|
case ${words[3]} in
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ Available search contexts are:
|
|||||||
| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
|
| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
|
||||||
| `chatgpt` | `https://chatgpt.com/?q=` |
|
| `chatgpt` | `https://chatgpt.com/?q=` |
|
||||||
| `claudeai` | `https://claude.ai/new?q=` |
|
| `claudeai` | `https://claude.ai/new?q=` |
|
||||||
| `grok` | `https://grok.com/?q=` |
|
| `grokcom` | `https://grok.com/?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=` |
|
| `rscrate` | `https://crates.io/search?q=` |
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ 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 chatgpt='web_search chatgpt'
|
alias chatgpt='web_search chatgpt'
|
||||||
alias grok='web_search grok'
|
alias grokcom='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'
|
||||||
|
|||||||
@@ -28,9 +28,12 @@ ZSH_THEME="robbyrussell"
|
|||||||
# zstyle ':omz:update' mode auto # update automatically without asking
|
# zstyle ':omz:update' mode auto # update automatically without asking
|
||||||
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
||||||
|
|
||||||
# Uncomment the following line to change how often to auto-update (in days).
|
# Uncomment the following line to change the frequency the auto-updater is run (in days).
|
||||||
# zstyle ':omz:update' frequency 13
|
# zstyle ':omz:update' frequency 13
|
||||||
|
|
||||||
|
# Uncomment the following line to set how old an update must be before it's applied, manually or via the auto-updater (in days).
|
||||||
|
# zstyle ':omz:update' cooldown 10
|
||||||
|
|
||||||
# Uncomment the following line if pasting URLs and other text is messed up.
|
# Uncomment the following line if pasting URLs and other text is messed up.
|
||||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
# DISABLE_MAGIC_FUNCTIONS="true"
|
||||||
|
|
||||||
|
|||||||
@@ -231,6 +231,10 @@ local ret=0
|
|||||||
remote=${"$(git config --local oh-my-zsh.remote)":-origin}
|
remote=${"$(git config --local oh-my-zsh.remote)":-origin}
|
||||||
branch=${"$(git config --local oh-my-zsh.branch)":-master}
|
branch=${"$(git config --local oh-my-zsh.branch)":-master}
|
||||||
|
|
||||||
|
# cooldown: minimum age (in days) of commits to apply
|
||||||
|
local cooldown_days
|
||||||
|
zstyle -s ':omz:update' cooldown cooldown_days || cooldown_days=0
|
||||||
|
|
||||||
# repository state
|
# repository state
|
||||||
last_head=$(git symbolic-ref --quiet --short HEAD || git rev-parse HEAD)
|
last_head=$(git symbolic-ref --quiet --short HEAD || git rev-parse HEAD)
|
||||||
# checkout update branch
|
# checkout update branch
|
||||||
@@ -242,7 +246,20 @@ last_commit=$(git rev-parse "$branch")
|
|||||||
if [[ $verbose_mode != silent ]]; then
|
if [[ $verbose_mode != silent ]]; then
|
||||||
printf "${BLUE}%s${RESET}\n" "Updating Oh My Zsh"
|
printf "${BLUE}%s${RESET}\n" "Updating Oh My Zsh"
|
||||||
fi
|
fi
|
||||||
if LANG= git pull --quiet --rebase $remote $branch; then
|
if {
|
||||||
|
if (( cooldown_days > 0 )); then
|
||||||
|
zmodload zsh/datetime
|
||||||
|
local cutoff_epoch cooldown_ref
|
||||||
|
cutoff_epoch=$(( EPOCHSECONDS - cooldown_days * 86400 ))
|
||||||
|
LANG= git fetch --quiet $remote $branch && {
|
||||||
|
cooldown_ref=$(git log --format="%H %ct" "$remote/$branch" \
|
||||||
|
| awk -v c="$cutoff_epoch" '$2 <= c { print $1; exit }')
|
||||||
|
[[ -z "$cooldown_ref" ]] || LANG= git merge --ff-only --quiet "$cooldown_ref"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LANG= git pull --quiet --rebase $remote $branch
|
||||||
|
fi
|
||||||
|
}; then
|
||||||
# Check if it was really updated or not
|
# Check if it was really updated or not
|
||||||
if [[ "$(git rev-parse HEAD)" = "$last_commit" ]]; then
|
if [[ "$(git rev-parse HEAD)" = "$last_commit" ]]; then
|
||||||
message="Oh My Zsh is already at the latest version."
|
message="Oh My Zsh is already at the latest version."
|
||||||
|
|||||||
Reference in New Issue
Block a user