Compare commits

...
53 Commits
Author SHA1 Message Date
Jim Weller abfce729ab feat(terragrunt): add terragrunt plugin (#13261) 2026-11-26 07:29:16 -08:00
Shahab Ahmed 070831e592 fix(extract): extract .deb members without double nesting (#14199)
Closes #14200
2026-11-26 07:29:06 -08:00
Federico Tensi e333686c2a feat(git-commit): support optional commit body (#14169) 2026-11-26 07:28:56 -08:00
Nuri Jung b1d468701a fix(git): remove unnecessary git rm from gwip (#13410) 2026-11-26 07:28:45 -08:00
kang 12a6ce7e42 feat(python): add recursive parent directory search for auto_vrun (#13523) 2026-11-26 07:20:36 -08:00
Kennan LeJeune f5a74e0347 feat(fnox): add plugin (#13593) 2026-11-26 07:20:27 -08:00
Randommisha13 0876f10264 feat(systemd): support other privilege elevation tools (#13695) 2026-11-26 07:20:17 -08:00
Thejesh 4d643a3c86 fix(web-search): escape reserved characters like + and & (#14275) 2026-11-26 07:20:09 -08:00
Thejesh 1a05a1091b fix(cli): add plugins to an empty plugins=() list (#14276) 2026-11-26 06:51:15 -08:00
Jonathan Stacks ad66117d08 feat(talosctl): add completions for talosctl (#13682) 2026-11-26 06:50:09 -08:00
Morningstar202604 964e5b65c6 fix(vi-mode): fix stale clipboard retry after failed push (#14141) 2026-11-26 06:45:29 -08:00
Ngonidzashe Mangudya 1eebae3a3f feat(laravel): add aliases for nWidart/laravel-modules (#14293) 2026-11-25 06:15:06 -08:00
mattmc3 ca5b808de8 feat(zsh-patina): add completions (#14296) 2026-11-25 06:11:57 -08:00
mattmc3 c8aea70a11 feat(zsh-patina): add completions (#14296) 2026-11-25 06:02:51 -08:00
Ininsico 799f9a8a8a fix(colorize): pass ZSH_COLORIZE_CHROMA_FORMATTER to cless (#13781)
Closes #12650
2026-11-24 21:22:08 -08:00
Mai-Lapyst 7140fedbfa docs(pre-commit): fix prek repository link (#13630) 2026-11-24 15:56:32 -08:00
Arbian Shkodra b5cb2fe952 feat(hcloud): add hcloud_prompt_info function (#13535) 2026-11-24 15:32:52 -08:00
Yu Xiang Z. 49766a713a perf(aws): read profiles and region from config files instead of the CLI (#13537)
* perf(aws): read profiles from config files before falling back to the CLI

`aws configure list-profiles` takes ~0.5s to start, and `asp`/`acp` tab
completion runs it every time. Read ~/.aws/config and ~/.aws/credentials
directly instead, and only call the CLI if neither file is readable.

* perf(aws): read the profile region from the config file in asp

`asp` ran `aws configure get region` on every switch, which takes ~0.5s,
and the saved-state restore ran it in every new shell. Read the region
from ~/.aws/config directly, and only call the CLI when the profile has
no region there.
2026-11-24 15:18:48 -08:00
Vincent Castelluci 570bd64a56 feat(mvn): add mvncpst and mvncpsto aliases (#13463) 2026-11-24 15:09:15 -08:00
Federico A. Corazza ad203cc9c4 fix(nicoulaj): remove executable bit from theme file (#13199) 2026-11-24 13:36:10 -08:00
danielwerg 89ec2b437b fix(man,tldr): move cursor to end of line after inserting the command (#13186) 2026-11-24 13:28:43 -08:00
mattmc3 3943d2f880 feat(zsh-patina): add zsh-patina plugin (#14225)
- eval `zsh-patina activate` when installed, else print install URL
- ZSH_PATINA_BINARY overrides the binary path, eg: ~/.cargo/bin
- skip with a warning when zsh-syntax-highlighting is enabled
- modeled on the zoxide plugin
2026-11-24 13:23:36 -08:00
Junpei Zhangandpei711 a449ed2c4e docs: fix grammar in uv plugin README (#14205)
Co-authored-by: pei711 <pei711@users.noreply.github.com>
2026-11-24 12:53:49 -08:00
JimMoen a32fc1d8ae feat(docker): add dvrm alias for docker volume rm (#11781) 2026-11-24 12:08:56 -08:00
Runrioter Wung 1195c3a15e fix(tmux): handle $EDITOR with options in tmuxconf alias (#14159)
* fix(tmux): handle `$EDITOR` with options in `tmuxconf` alias

* docs(tmux): update docs for `tmuxconf`
2026-11-24 11:39:45 -08:00
Srinivas Chippagiri f68e5ec392 fix(poetry): make psh and psync work with Poetry 2 (#14283) 2026-11-24 11:37:22 -08:00
27506acc8a fix(encode64): support BSD base64 and quote arguments (#14269)
* encode64: support BSD base64 and quote arguments

* chore: remove pr-body.md and pr-title.txt from branch

---------

Co-authored-by: pei711 <pei711@users.noreply.github.com>
Co-authored-by: pei711 <3922088406@qq.com>
2026-11-24 11:28:08 -08:00
Morningstar202604 109270911c feat(cli): add omz diagnose locale check (#14140)
* feat(core): add `omz diagnose` locale check

Reports whether the runtime locale is UTF-8, using the CODESET parameter
of the zsh/langinfo module that lib/functions.zsh already loads at startup,
with a `locale charmap` fallback when the module is unavailable. Non-UTF-8
charsets cause completion glitches such as duplicated characters at the
prompt.

This replaces the startup warning proposed in the earlier iteration: per
maintainer feedback the check belongs in `omz diagnose` so that no shell
startup cost is paid and it only surfaces when the user is already
debugging their setup.

I used AI to draft and rework this change.

* docs: document omz diagnose in README

Add a Diagnostics section below the update instructions describing
`omz diagnose` and pointing at `omz_diagnostic_dump` for full reports.

I used AI to draft this change.
2026-11-24 11:28:01 -08:00
Morningstar202604andMorningstar202604 49a6348eac fix(dirhistory): fix typo in push_future duplicate check (#14149)
`push_future` referenced `$dirhistory_futuret` (missing the 'e' - a
typo) in its duplicate check, so `$dirhistory_futuret[...]` was an
undefined variable and consecutive identical entries were never skipped.
ALT-RIGHT navigation then revisited the same directory repeatedly.
Match `push_past`, which uses `$dirhistory_past` correctly.

Co-authored-by: Morningstar202604 <morningstar202604@users.noreply.github.com>
2026-11-24 11:27:54 -08:00
anacletoTM 2aa7aed78b fix(ember-cli): correct version help completion (#14281) 2026-11-24 10:47:01 -08:00
dependabot[bot] 93b87c9c9a chore(deps): bump semver (#14271)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-24 10:49:33 +01:00
dependabot[bot] 8a85fa2243 chore(deps): bump the gha-minor group with 3 updates (#14272)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-24 10:49:18 +01:00
Faris Basha TM 6c31a91a3e docs(jj): fix dead link to the template syntax docs (#14259)
The jj documentation moved from martinvonz.github.io/jj to
docs.jj-vcs.dev, and the old templates page now returns 404.
2026-11-23 16:33:06 -08:00
TINGyu123644 c52efbc756 docs(dotenv): fix dead 1Password Environments doc link (#14257)
The link to the 1Password Environments docs used the old singular
`/docs/environment/` path which now returns 404. 1Password moved the
page to the plural `/docs/environments/` path. Updates the single link
in the dotenv plugin README so readers reach the current docs.
2026-11-23 16:16:49 -08:00
Rasmus Skovgaard Lauritsen e35c9b4b67 feat(bitwarden): add completions for bw and bws (#14261)
* feat(bws): add completion plugin

* feat(bitwarden): unify bw and bws completions
2026-11-23 15:56:41 -08:00
Divya 87aa1a9b89 fix(changelog): hide reverted commits again after the switch to 12-char hashes (#14262)
* fix(changelog): hide reverted commits again after the switch to 12-char hashes

Since #12096 the commit list is read with `--abbrev=12`, so the `types`
array is keyed by 12-character hashes, but `commit:is-revert` still
returned the first 7 characters of the reverted hash. The lookup in
`display-release` never matched, and both a reverted commit and its
`Revert "..."` commit were listed in the changelog.

* test(changelog): cover hiding reverted commits
2026-11-22 10:18:48 -08:00
Divya ca0a63f0ee fix(jsontools): print JSON, not YAML, in pp_json with the ruby method (#14263)
* fix(jsontools): print JSON, not YAML, in `pp_json` with the ruby method

The ruby implementation of `pp_json` converted the parsed input to YAML
(`to_yaml`), while the node and python3 implementations, and the README,
pretty-print JSON. Use `JSON.pretty_generate` with the same 4-space
indent as the other methods.

* test(jsontools): cover the ruby method
2026-11-22 10:16:39 -08:00
Martino Pulici a7f4e49946 fix(alias-finder): avoid echo escape evaluation and xargs errors (#14264) 2026-11-22 10:12:23 -08:00
Julian Oes 3ecde00d94 fix(mortalscumbag): compare against the tracked branch, not origin (#14265)
The ahead/behind markers compared HEAD with `origin/<branch>`, so in a
fork where the branch tracks a different remote they reported the
difference to `origin` instead of to the branch's own upstream. Use
`@{upstream}`, like `git_commits_ahead`/`git_commits_behind` in
lib/git.zsh do. A branch without an upstream shows no marker.
2026-11-22 10:09:30 -08:00
Sainnhe Park 902761f897 feat(gcloud): support FreeBSD (#14268)
FreeBSD installs zsh completion def into `/usr/local/google-cloud-sdk/completion.zsh.inc`. This commit adds `/usr/local/google-cloud-sdk` to `search_locations` so the gcloud plugin can discover this file.
2026-11-22 09:55:06 -08:00
Martino Pulici c0140703a5 fix(alias-finder): localize c and cmdLen variables (#14253) 2026-11-16 13:08:14 +01:00
Zain Qureshi ffe93241cc docs(drush): fix drdmp expansion (#14138) 2026-11-16 13:07:55 +01:00
dependabot[bot] ca82ba6831 chore(deps): bump semver from 3.1.0 to 3.1.1 in /.github/workflows/dependencies in the py-minor group (#14255)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-16 12:59:33 +01:00
dependabot[bot] e957b67eed chore(deps): bump step-security/harden-runner from 2.22.3 to 2.22.4 in the gha-minor group (#14254)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-16 12:59:30 +01:00
Paolo Valletta 6010fb6260 fix(mvn): complete with compsys instead of compctl (#14241) 2026-11-09 13:36:11 +01:00
Iain 044bcbf82d fix(npm): replace removed npm bin in npmE (#14250) 2026-11-09 13:34:47 +01:00
dependabot[bot] 2d03d8ac01 chore(deps): bump github/codeql-action/upload-sarif from 4.39.1 to 4.39.3 in the gha-minor group (#14249)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-09 13:33:18 +01:00
Robby Russell f5d571c66d feat(core): invite users to star the repo on github (#14248) 2026-11-09 13:32:35 +01:00
Iain cca3bdfbef fix(web-search)!: remove ask.com, which has shut down (#14244)
BREAKING CHANGE: the `ask` engine and alias are removed from the web-search plugin, because Ask.com has shut down.
2026-11-06 05:42:13 -08:00
Wei-Lun Li 59ff4d042e fix(timer): round duration before splitting off minutes (#14246) 2026-11-06 05:40:48 -08:00
dependabot[bot] b509b1c6ed chore(deps): bump certifi (#14237)
Bumps the py-minor group in /.github/workflows/dependencies with 1 update: [certifi](https://github.com/certifi/python-certifi).


Updates `certifi` from 2026.10.19 to 2026.10.23
- [Commits](https://github.com/certifi/python-certifi/compare/2026.10.19...2026.10.23)

---
updated-dependencies:
- dependency-name: certifi
  dependency-version: 2026.10.23
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: py-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-02 09:23:31 +01:00
dependabot[bot] c483ff288d chore(deps): bump step-security/harden-runner (#14238)
Bumps the gha-minor group with 1 update: [step-security/harden-runner](https://github.com/step-security/harden-runner).


Updates `step-security/harden-runner` from 2.22.2 to 2.22.3
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/dc2769abcc0fcfbadfc1df54081c1608579ef6b2...46b06cea07f9e64621fdf066ba77ac6915163d43)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.22.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gha-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-02 09:23:10 +01:00
BreakerandCarlo Sala 17a2b4c3a5 fix(clipboard): strip PowerShell carriage returns on WSL (#14216)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-10-27 12:37:49 +01:00
74 changed files with 1055 additions and 98 deletions

No files matched your search

+2 -2
View File
@@ -16,7 +16,7 @@ jobs:
contents: write # this is needed to push commits and branches
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
@@ -26,7 +26,7 @@ jobs:
fetch-depth: 0
- name: Authenticate as @ohmyzsh
id: generate-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
@@ -1,7 +1,7 @@
certifi==2026.10.19
certifi==2026.10.23
charset-normalizer==3.5.2
idna==3.20
PyYAML==6.0.3
requests==2.34.2
semver==3.1.0
semver==3.1.2
urllib3==2.8.0
+2 -2
View File
@@ -26,7 +26,7 @@ jobs:
- macos-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
@@ -47,7 +47,7 @@ jobs:
- test
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
+1 -1
View File
@@ -24,7 +24,7 @@ jobs:
if: github.repository == 'ohmyzsh/ohmyzsh'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
+2 -2
View File
@@ -17,12 +17,12 @@ jobs:
if: github.repository == 'ohmyzsh/ohmyzsh'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
- name: Authenticate as @ohmyzsh
id: generate-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
+3 -3
View File
@@ -36,7 +36,7 @@ jobs:
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
@@ -46,7 +46,7 @@ jobs:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0
uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0
with:
results_file: results.sarif
results_format: sarif
@@ -60,6 +60,6 @@ jobs:
retention-days: 5
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
sarif_file: results.sarif
+14
View File
@@ -552,6 +552,20 @@ omz update
Magic! 🎉
## Diagnostics
If something looks off (glitched characters, completions misbehaving), run:
```sh
omz diagnose
```
It runs a few quick checks and tells you what to fix — for example, it will warn you when
your locale is not UTF-8, which is a common cause of duplicated characters at the prompt
(see the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-see-duplicate-typed-characters-after-i-complete-a-command)).
For a full report suitable for attaching to a bug report, use `omz_diagnostic_dump`.
## Uninstalling Oh My Zsh
Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup.
+27 -2
View File
@@ -24,6 +24,7 @@ function _omz {
local -a cmds subcmds
cmds=(
'changelog:Print the changelog'
'diagnose:Run configuration diagnostics'
'help:Usage information'
'plugin:Manage plugins'
'pr:Manage Oh My Zsh Pull Requests'
@@ -176,12 +177,36 @@ function _omz::log {
## User-facing commands
function _omz::diagnose {
# Check the runtime locale: non-UTF-8 charsets are known to cause glitches
# such as duplicated characters at the prompt after completions.
# https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-see-duplicate-typed-characters-after-i-complete-a-command
#
# `lib/functions.zsh` loads the zsh/langinfo module at startup, so the
# CODESET parameter is already available without any subprocess; only fall
# back to `locale charmap` when that module is unavailable (zsh built without it).
local codeset="${langinfo[CODESET]:-}"
if [[ -z "$codeset" ]] && (( $+commands[locale] )); then
codeset="$(locale charmap 2>/dev/null)"
fi
if [[ "${codeset:l}" = (utf-8|utf8) ]]; then
_omz::log info "locale charmap is UTF-8"
else
_omz::log warn "your locale is not UTF-8 (charmap: ${codeset:-unknown})"
_omz::log info "non-UTF-8 locales may cause glitches in completions and international characters"
_omz::log info "consider setting a UTF-8 locale, e.g.: export LANG=C.UTF-8"
return 1
fi
}
function _omz::help {
cat >&2 <<EOF
Usage: omz <command> [options]
Available commands:
diagnose Run configuration diagnostics
help Print this help message
changelog Print the changelog
plugin <command> Manage plugins
@@ -367,8 +392,8 @@ function _omz::plugin::enable {
# Enable plugins awk script
local awk_script="
# if plugins=() is in oneline form, substitute ) with new plugins and go to the next line
/^[ \t]*plugins=\([^#]+\).*\$/ {
# if plugins=() is in oneline form (empty or not), substitute ) with new plugins and go to the next line
/^[ \t]*plugins=\([^#]*\).*\$/ {
sub(/\)/, \" $add_plugins&\")
print \$0
next
+4 -1
View File
@@ -59,7 +59,10 @@ function detect-clipboard() {
function clippaste() { cat /dev/clipboard; }
elif (( $+commands[clip.exe] )) && (( $+commands[powershell.exe] )); then
function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; }
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
function clippaste() {
setopt localoptions pipefail
powershell.exe -noprofile -command Get-Clipboard | tr -d '\r'
}
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
function clippaste() { wl-paste --no-newline; }
+9 -5
View File
@@ -1,5 +1,5 @@
alias-finder() {
local cmd=" " exact="" longer="" cheaper="" wordEnd="'?$" finder="" filter=""
local c="" cmd=" " exact="" longer="" cheaper="" wordEnd="'?$" finder="" filter="" cmdLen=""
# build command and options
for c in "$@"; do
@@ -19,11 +19,15 @@ alias-finder() {
zstyle -t ':omz:plugins:alias-finder' cheaper && cheaper=true
# format cmd for grep
## - replace newlines with spaces
## - replace newlines and multiple spaces with one space
## - trim both ends
## - replace multiple spaces with one space
## - add escaping character to special characters
cmd=$(echo -n "$cmd" | tr '\n' ' ' | xargs | tr -s '[:space:]' | sed 's/[].\|$(){}?+*^[]/\\&/g')
setopt localoptions extendedglob
cmd=${cmd//[[:space:]]##/ }
cmd=${cmd# }
cmd=${cmd% }
local esc_pattern='(#m)[][.\\|$(){}?+*^]' MATCH MBEGIN MEND
cmd=${cmd//${~esc_pattern}/\\$MATCH}
if [[ $longer == true ]]; then
wordEnd="" # remove wordEnd to find longer aliases
@@ -35,7 +39,7 @@ alias-finder() {
# make filter to find only shorter results than current cmd
if [[ $cheaper == true ]]; then
cmdLen=$(echo -n "$cmd" | wc -c)
cmdLen=${#cmd}
if [[ $cmdLen -le 1 ]]; then
return
fi
+2 -1
View File
@@ -35,7 +35,8 @@ plugins=(... aws)
* `aws_change_access_key`: changes the AWS access key of a profile.
* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`) and
`$AWS_SHARED_CREDENTIALS_FILE` (default: `~/.aws/credentials`).
Used to provide completion for the `asp` function.
* `aws_regions`: lists the available regions.
+43 -5
View File
@@ -42,7 +42,7 @@ function asp() {
export AWS_PROFILE=$1
export AWS_EB_PROFILE=$1
export AWS_PROFILE_REGION=$(aws configure get region)
export AWS_PROFILE_REGION=$(_aws_profile_region "$1")
_aws_update_state
@@ -239,9 +239,47 @@ function aws_regions() {
}
function aws_profiles() {
aws --no-cli-pager configure list-profiles 2> /dev/null && return
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
command grep -Eo '^[[:space:]]*\[[[:space:]]*(profile[[:space:]]+)?[^][:space:]]+[[:space:]]*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | command sed -E 's/^[[:space:]]*\[[[:space:]]*(profile[[:space:]]+)?([^][:space:]]+)[[:space:]]*\]$/\2/'
emulate -L zsh
local config="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
local creds="${AWS_SHARED_CREDENTIALS_FILE:-$HOME/.aws/credentials}"
# Read the files directly; the AWS CLI is slow to start
if [[ ! -r "$config" && ! -r "$creds" ]]; then
aws --no-cli-pager configure list-profiles 2> /dev/null
return
fi
local line words
# Only read the section headers, so the credentials never enter the shell
for line in "${(@f)$(command grep -h '^[[:space:]]*\[' -- "$config" "$creds" 2> /dev/null)}"; do
line=${line#*\[} # drop up to the first [
line=${line%\]*} # drop from the last ] (comments, CR)
words=(${=line})
if (( $#words == 1 )); then
print -r -- $words[1] # [default], or [foo] in the credentials file
elif (( $#words == 2 )) && [[ $words[1] == profile ]]; then
print -r -- $words[2]
fi
done | command sort -u
}
# Read a profile's region from the config file, falling back to the AWS CLI
function _aws_profile_region() {
emulate -L zsh
local config="${AWS_CONFIG_FILE:-$HOME/.aws/config}" line words in_profile
if [[ -r "$config" ]]; then
# Only read headers and region lines, so any credentials never enter the shell
for line in "${(@f)$(command grep -e '\[' -e region -- "$config" 2> /dev/null)}"; do
line=${line%$'\r'}
words=(${=line//[\[\]=]/ }) # "[profile foo]" -> (profile foo), "region = x" -> (region x)
if [[ ${${=line}[1]} == \[* ]]; then # header, possibly indented
in_profile=
[[ "$words" == "profile $1" || ( $1 == default && "$words" == default ) ]] && in_profile=1
elif [[ -n $in_profile && $words[1] == region ]]; then
print -r -- $words[2]
return
fi
done
fi
aws configure get region
}
function _aws_regions() {
@@ -285,7 +323,7 @@ if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
test -z "${aws_state[2]}" && AWS_REGION=$(aws configure get region)
test -z "${aws_state[2]}" && AWS_REGION=$(_aws_profile_region "$AWS_PROFILE")
export AWS_REGION=${AWS_REGION:-$aws_state[2]}
export AWS_DEFAULT_REGION="$AWS_REGION"
+16
View File
@@ -0,0 +1,16 @@
# Bitwarden plugin
This plugin adds Zsh completions for whichever Bitwarden CLIs are installed:
- [Bitwarden CLI (`bw`)](https://bitwarden.com/help/cli/)
- [Bitwarden Secrets Manager CLI (`bws`)](https://bitwarden.com/help/secrets-manager-cli/)
To enable it, add `bitwarden` to the plugins array in your `.zshrc`:
```zsh
plugins=(... bitwarden)
```
Each installed CLI generates and refreshes its own completion cache in the
background when the plugin loads. The cache files are
`$ZSH_CACHE_DIR/completions/_bw` and `$ZSH_CACHE_DIR/completions/_bws`.
+45
View File
@@ -0,0 +1,45 @@
# Autocompletion for the Bitwarden CLI (bw) and Secrets Manager CLI (bws).
() {
local cli completion cache_file
local -a generator_args
for cli in bw bws; do
completion="_$cli"
cache_file="$ZSH_CACHE_DIR/completions/$completion"
if (( ! $+commands[$cli] )); then
# compinit can register a cached completion after the CLI is removed.
if [[ -f "$cache_file" && ${_comps[$cli]-} == "$completion" ]]; then
unset "_comps[$cli]"
fi
continue
fi
case "$cli" in
bw)
generator_args=(completion --shell zsh)
# bw emits function definitions. Use ksh-style autoload to run _bw
# on the first Tab press as well as loading its helper functions.
autoload -Uk "$completion"
;;
bws)
generator_args=(completions zsh)
autoload -Uz "$completion"
;;
esac
# Register the completion if compinit hasn't picked it up yet.
if [[ -z ${_comps[$cli]-} ]]; then
_comps[$cli]=$completion
fi
() {
zmodload -F zsh/files b:zf_mv || return
local temp_file
temp_file=$(mktemp "${cache_file:h}/.$completion.XXXXXXXX") || return
if command "$cli" "$@" >| "$temp_file" && [[ -s "$temp_file" ]] &&
zf_mv -f -- "$temp_file" "$cache_file"; then
return
fi
rm -f -- "$temp_file"
} "${generator_args[@]}" &|
done
}
+1
View File
@@ -90,6 +90,7 @@ colorize_less() {
# (e.g. when not scrolled to the bottom) while already the next file will be displayed.
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
ZSH_COLORIZE_CHROMA_FORMATTER=$ZSH_COLORIZE_CHROMA_FORMATTER \
colorize_cat %s 2> /dev/null'"
# LESSCLOSE will be set to prevent any errors by executing a user script
+1 -1
View File
@@ -52,7 +52,7 @@ function push_future() {
if [[ $#dirhistory_future -ge $DIRHISTORY_SIZE ]]; then
shift dirhistory_future
fi
if [[ $#dirhistory_future -eq 0 || $dirhistory_futuret[$#dirhistory_future] != "$1" ]]; then
if [[ $#dirhistory_future -eq 0 || $dirhistory_future[$#dirhistory_future] != "$1" ]]; then
dirhistory_future+=($1)
fi
}
+1
View File
@@ -84,6 +84,7 @@ If you use Podman's Docker wrapper, you need to enable legacy completion. See ab
| dtop | `docker top` | Display the running processes of a container |
| dvi | `docker volume inspect` | Display detailed information about one or more volumes |
| dvls | `docker volume ls` | List all the volumes known to docker |
| dvrm | `docker volume rm` | Remove one or more volumes |
| dvprune | `docker volume prune` | Cleanup dangling volumes |
| dxc | `docker container exec` | Run a new command in a running container |
| dxcit | `docker container exec -it` | Run a new command in a running container in an interactive shell |
+1
View File
@@ -35,6 +35,7 @@ alias dsts='docker stats'
alias dtop='docker top'
alias dvi='docker volume inspect'
alias dvls='docker volume ls'
alias dvrm='docker volume rm'
alias dvprune='docker volume prune'
alias dxc='docker container exec'
alias dxcit='docker container exec -it'
+1 -1
View File
@@ -100,7 +100,7 @@ takes preference, _i.e._ the .env file will never be sourced.
## Named Pipe (FIFO) Support
The plugin supports `.env` files provided as UNIX named pipes (FIFOs) in addition to regular files.
This is useful when secrets managers like [1Password Environments](https://developer.1password.com/docs/environment/)
This is useful when secrets managers like [1Password Environments](https://developer.1password.com/docs/environments/)
mount `.env` files as named pipes to inject secrets on-the-fly without writing them to disk.
No additional configuration is required — the plugin automatically detects and sources named pipes.
+1 -1
View File
@@ -25,7 +25,7 @@ plugins=(... drush)
| `drcr` | `drush core-cron` | Run all cron hooks in all active modules for specified site |
| `drct` | `drush cc theme-registry` | Clear theme-registry cache |
| `drcv` | `drush cc views` | Clear views cache _(make sure that the views module is enabled)_ |
| `drdmp` | `drush drush sql-dump --ordered-dump --result-file=dumpsql` | Backup database in a new dump.sql file |
| `drdmp` | `drush sql-dump --ordered-dump --result-file=dump.sql` | Backup database in a new dump.sql file |
| `drf` | `drush features` | Display features status |
| `drfr` | `drush features-revert -y` | Revert a feature module on your site |
| `drfra` | `drush features-revert-all` | Revert all enabled feature module on your site |
+1 -1
View File
@@ -40,7 +40,7 @@ case $state in
'new' \
'serve' \
'test' \
'vesion' && ret=0
'version' && ret=0
;;
addon)
_arguments \
+3 -3
View File
@@ -46,10 +46,10 @@ Encode a file's contents to base64 and save output to text file.
- From parameter
```console
$ encodefile64 ohmyzsh.icn
ohmyzsh.icn's content encoded in base64 and saved as ohmyzsh.icn.txt
$ encodefile64 oh-my-zsh
oh-my-zsh's content encoded in base64 and saved as oh-my-zsh.txt
$ ef64 "oh-my-zsh"
ohmyzsh.icn's content encoded in base64 and saved as ohmyzsh.icn.txt
oh-my-zsh's content encoded in base64 and saved as oh-my-zsh.txt
```
### Decoding
+21 -8
View File
@@ -2,24 +2,37 @@ encode64() {
if [[ $# -eq 0 ]]; then
cat | base64
else
printf '%s' $1 | base64
printf '%s' "$1" | base64
fi
}
encodefile64() {
if [[ $# -eq 0 ]]; then
echo "You must provide a filename"
else
base64 $1 > $1.txt
echo "${1}'s content encoded in base64 and saved as ${1}.txt"
if [[ $# -ne 1 || ! -f "$1" || ! -r "$1" ]]; then
print -u2 -- 'Usage: encodefile64 <file>'
return 1
fi
local file="$1" output="${1}.txt" tmp_file
[[ $output == /* ]] || output="./$output"
tmp_file=$(mktemp "${output}.XXXXXX") || return 1
if ! base64 < "$file" > "$tmp_file"; then
command rm -f "$tmp_file"
return 1
fi
if ! command mv "$tmp_file" "$output"; then
command rm -f "$tmp_file"
return 1
fi
print -- "$file's content encoded in base64 and saved as ${file}.txt"
}
decode64() {
if [[ $# -eq 0 ]]; then
cat | base64 --decode
cat | base64 -d
else
printf '%s' $1 | base64 --decode
printf '%s' "$1" | base64 -d
fi
}
alias e64=encode64
+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env zsh
emulate -LR zsh
source "${1:-${0:A:h:h}/encode64.plugin.zsh}"
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
cd "$test_dir" || exit 1
typeset -i failures=0 tests=0
typeset output expected_output
check_result() {
local description="$1" expected_status="$2" expected_stdout="$3" expected_stderr="$4"
shift 4
output=$("$@" 2> "$test_dir/stderr")
local actual_status=$?
(( tests++ ))
if [[ $actual_status == $expected_status && $output == "$expected_stdout" && $(<"$test_dir/stderr") == "$expected_stderr" ]]; then
print -r -- "PASS: $description"
else
print -u2 -r -- "FAIL: $description"
print -u2 -r -- " status: $actual_status (expected $expected_status)"
print -u2 -r -- " stdout: ${(qqq)output} (expected ${(qqq)expected_stdout})"
print -u2 -r -- " stderr: $(<"$test_dir/stderr") (expected $expected_stderr)"
(( failures++ ))
fi
}
check_encode_arg() { encode64 'oh-my-zsh'; }
check_encode_empty() { encode64 ''; }
check_decode_arg() { decode64 'b2gtbXktenNo'; }
expected_output=$(printf '%s' 'oh-my-zsh' | base64)
check_result 'encode argument' 0 "$expected_output" '' check_encode_arg
check_result 'encode empty argument' 0 '' '' check_encode_empty
check_result 'decode argument' 0 'oh-my-zsh' '' check_decode_arg
file="$test_dir/file with spaces.txt"
print -r -- 'file contents' >| "$file"
encodefile64 "$file" > "$test_dir/stdout" 2> "$test_dir/stderr"
file_status=$?
expected_output=$(base64 < "$file")
(( tests++ ))
if [[ $file_status == 0 && $(<"${file}.txt") == "$expected_output" && $(<"$test_dir/stdout") == "$file's content encoded in base64 and saved as ${file}.txt" && ! -s "$test_dir/stderr" ]]; then
print -r -- 'PASS: encode file with spaces'
else
print -u2 -r -- 'FAIL: encode file with spaces'
(( failures++ ))
fi
check_invalid_file() { encodefile64 ''; }
check_result 'empty filename' 1 '' 'Usage: encodefile64 <file>' check_invalid_file
if [[ -e .txt ]]; then
print -u2 -r -- 'FAIL: empty filename created .txt'
(( failures++ ))
command rm -f .txt
fi
print -r -- 'preserve existing output' >| "${file}.txt"
base64() { return 42; }
encodefile64 "$file" > "$test_dir/stdout" 2> "$test_dir/stderr"
file_status=$?
unset -f base64
(( tests++ ))
if [[ $file_status != 0 && $(<"${file}.txt") == 'preserve existing output' && ! -s "$test_dir/stdout" ]]; then
print -r -- 'PASS: failed encoding preserves existing output'
else
print -u2 -r -- 'FAIL: failed encoding preserves existing output'
(( failures++ ))
fi
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
+34 -3
View File
@@ -135,9 +135,40 @@ EOF
(*.deb)
command mkdir -p "control" "data"
ar vx "$full_path" > /dev/null
builtin cd -q control; extract ../control.tar.*
builtin cd -q ../data; extract ../data.tar.*
builtin cd -q ..; command rm *.tar.* debian-binary ;;
local member= dest= failed=0
for member in control.tar.* data.tar.*; do
dest="${member%%.*}"
case "${member:l}" in
(*.tar.gz)
(( $+commands[pigz] )) && { tar -I pigz -xvf "$member" -C "$dest" } \
|| tar zxvf "$member" -C "$dest" ;;
(*.tar.bz2)
(( $+commands[pbzip2] )) && { tar -I pbzip2 -xvf "$member" -C "$dest" } \
|| tar xvjf "$member" -C "$dest" ;;
(*.tar.xz)
# .deb members are small, so skip extract()'s pixz fast path and
# let tar use its built-in xz support (or a plain pipe).
tar --xz --help &> /dev/null \
&& tar --xz -xvf "$member" -C "$dest" \
|| xzcat "$member" | tar xvf - -C "$dest" ;;
(*.tar.zst)
tar --zstd --help &> /dev/null \
&& tar --zstd -xvf "$member" -C "$dest" \
|| zstdcat "$member" | tar xvf - -C "$dest" ;;
(*.tar)
tar xvf "$member" -C "$dest" ;;
(*)
echo "extract: cannot extract unexpected .deb member '$member'" >&2
failed=1
success=1 ;;
esac
done
if (( failed )); then
# Keep the archive members so the unexpected one can be inspected.
echo "extract: leaving .deb members in place" >&2
else
command rm *.tar.* debian-binary
fi ;;
(*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
(*.cab|*.exe) cabextract "$full_path" ;;
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
+120 -1
View File
@@ -4,7 +4,7 @@
emulate -L zsh
setopt err_return
for tool in lzma unlzma uncompress; do
for tool in ar lzma unlzma uncompress; do
(( $+commands[$tool] )) || {
print -u2 -r -- "These tests require $tool."
exit 1
@@ -46,6 +46,120 @@ check_extract() {
print -r -- "PASS: $extension ($mode)"
}
# Extracting a .deb must place the control members directly in <name>/control
# and the data members directly in <name>/data, whatever their member count.
check_deb_extract() {
local mode=$1
local case_dir="$test_dir/deb-$mode"
mkdir -p "$case_dir/source files" "$case_dir/work/target dir" \
"$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "conf:1" > "$case_dir/src/ctl/conffiles"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" conffiles postinst
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
rm -f "$case_dir/source files/pkg.deb"
ar rS "$case_dir/source files/pkg.deb" debian-binary control.tar.gz data.tar.gz
)
local archive="$case_dir/source files/pkg.deb"
builtin cd "$case_dir/work"
local base="$PWD/pkg"
local -a args
case "$mode" in
target)
args=(-t 'target dir')
base="$PWD/target dir/pkg"
;;
remove) args=(-r) ;;
esac
() {
emulate -L zsh
extract "${args[@]}" "$archive"
} || return 1
[[ -f "$base/control/conffiles" && -f "$base/control/postinst" ]] ||
{ print -u2 -r -- "$mode: control members not extracted into $base/control"; return 1 }
[[ -f "$base/data/usr/bin/app" ]] ||
{ print -u2 -r -- "$mode: data members not extracted into $base/data"; return 1 }
[[ ! -d "$base/control/control" && ! -d "$base/data/data" ]] ||
{ print -u2 -r -- "$mode: deb extraction double-nested the member directories"; return 1 }
[[ ! -e "$base/control.tar.gz" && ! -e "$base/data.tar.gz" && ! -e "$base/debian-binary" ]] ||
{ print -u2 -r -- "$mode: deb member debris left behind"; return 1 }
if [[ $mode == remove ]]; then
[[ ! -e $archive ]]
else
[[ -f $archive ]]
fi
print -r -- "PASS: deb ($mode)"
}
# An unexpected member must be reported and left on disk for inspection, and
# the cleanup must not delete the other members around it either.
check_deb_unexpected_member() {
local case_dir="$test_dir/deb-unexpected"
mkdir -p "$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" postinst
print -r -- "unknown compression" > "$case_dir/src/control.tar.weird"
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
ar rS "$case_dir/pkg.deb" debian-binary control.tar.weird data.tar.gz
)
builtin cd "$case_dir"
() {
emulate -L zsh
extract "$case_dir/pkg.deb"
} || return 1
[[ -f "$case_dir/pkg/data/usr/bin/app" ]] ||
{ print -u2 -r -- "deb-unexpected: known members were not extracted"; return 1 }
[[ -f "$case_dir/pkg/control.tar.weird" && -f "$case_dir/pkg/data.tar.gz" &&
-f "$case_dir/pkg/debian-binary" ]] ||
{ print -u2 -r -- "deb-unexpected: archive members were deleted"; return 1 }
print -r -- "PASS: deb (unexpected member)"
}
# Passing more than one .deb in a single call must not leak the loop variables
# between archives; the stale `member`/`dest` locals used to be printed by the
# second archive.
check_deb_multiple() {
local case_dir="$test_dir/deb-multiple"
mkdir -p "$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" postinst
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
ar rS "$case_dir/one.deb" debian-binary control.tar.gz data.tar.gz
ar rS "$case_dir/two.deb" debian-binary control.tar.gz data.tar.gz
)
builtin cd "$case_dir"
local output
output=$( () {
emulate -L zsh
extract one.deb two.deb
} 2>&1 ) || return 1
[[ $output != *member=* && $output != *dest=* ]] ||
{ print -u2 -r -- "deb-multiple: stale loop variables were printed"; return 1 }
[[ -f one/control/postinst && -f one/data/usr/bin/app &&
-f two/control/postinst && -f two/data/usr/bin/app ]] ||
{ print -u2 -r -- "deb-multiple: both archives were not extracted"; return 1 }
print -r -- "PASS: deb (multiple archives)"
}
{
print -r -- hello > "$test_dir/plain"
lzma -c "$test_dir/plain" > "$test_dir/fixture.lzma"
@@ -58,6 +172,11 @@ check_extract() {
check_extract "$extension" "$mode"
done
done
check_deb_extract default
check_deb_extract target
check_deb_extract remove
check_deb_unexpected_member
check_deb_multiple
print 'All extract compressed-file tests passed.'
} always {
builtin cd "$original_dir"
+15
View File
@@ -0,0 +1,15 @@
# fnox
Adds shell integration and completions for [fnox](https://github.com/jdx/fnox), a tool for provider-agnostic secret injection.
## Installation
[Install fnox](https://fnox.jdx.dev/guide/quick-start.html), then add it to your plugins in `~/.zshrc`:
```zsh
plugins=(fnox)
```
## Usage
See the [fnox documentation](https://fnox.jdx.dev/guide/shell-integration.html) for shell integration and usage.
+23
View File
@@ -0,0 +1,23 @@
if (( ! $+commands[fnox] )); then
# if we don't have fnox at all just bail out
return
fi
eval "$(fnox activate zsh)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `fnox`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_fnox" ]]; then
typeset -g -A _comps
autoload -Uz _fnox
_comps[fnox]=_fnox
fi
# Regenerate completions when the executable changes.
if [[ ! -s "$ZSH_CACHE_DIR/completions/_fnox" || "$commands[fnox]" -nt "$ZSH_CACHE_DIR/completions/_fnox" ]]; then
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._fnox"
zf_mv -f -- =( fnox completion zsh ) "$ZSH_CACHE_DIR/completions/_fnox"
} &|
fi
+1
View File
@@ -7,6 +7,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
search_locations=(
"$HOME/google-cloud-sdk"
"/usr/local/share/google-cloud-sdk"
"/usr/local/google-cloud-sdk"
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/opt/homebrew/share/google-cloud-sdk"
+6 -2
View File
@@ -12,7 +12,7 @@ plugins=(... git-commit)
## Syntax
```zsh
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] "<message>"
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] [(-b, --body) "<body>"] "<message>"
```
Where `type` is one of the following:
@@ -30,6 +30,9 @@ Where `type` is one of the following:
- `test`
- `wip`
The optional `-b` / `--body` becomes the commit body (a blank line after the subject), as defined by
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary).
> NOTE: the subcommand for `revert` type is `rev`, as otherwise it conflicts with the
> git command of the same name. It will still generate a commit message in the format
> `revert: <message>`
@@ -39,6 +42,7 @@ Where `type` is one of the following:
| Git subcommand | Command |
| --------------------------------------------- | ---------------------------------------------------- |
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
| `git wip "work in progress"` | `git commit -m "work in progress"` |
| `git wip "work in progress"` | `git commit -m "wip: work in progress"` |
| `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` |
| `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` |
| `git feat -s "auth" -b "Keep session across redirects." "add login redirect"` | `git commit -m "feat(auth): add login redirect" -m "Keep session across redirects."` |
+11 -3
View File
@@ -12,11 +12,11 @@ _omz_git_commit() {
if [[ "$_type" == rev ]]; then
_type=revert
fi
local _scope _attention _message
local _scope _attention _message _body
while [ $# -ne 0 ]; do
case $1 in
-s | --scope )
if [ -z $2 ]; then
if [ -z "$2" ]; then
echo >&2 "Missing scope!"
return 1
fi
@@ -27,12 +27,20 @@ _omz_git_commit() {
_attention="!"
shift 1
;;
-b | --body )
if [ -z "$2" ]; then
echo >&2 "Missing body!"
return 1
fi
_body="$2"
shift 2
;;
* )
_message="${_message} $1"
shift 1
;;
esac
done
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}"
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}" ${_body:+-m} ${_body:+"$_body"}
}
_omz_git_commit "$@"
+1 -1
View File
@@ -21,7 +21,7 @@ plugins=(... git)
| `gapa` | `git add --patch` |
| `gau` | `git add --update` |
| `gav` | `git add --verbose` |
| `gwip` | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` |
| `gwip` | `git add -A; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` |
| `gam` | `git am` |
| `gama` | `git am --abort` |
| `gamc` | `git am --continue` |
+1 -1
View File
@@ -119,7 +119,7 @@ alias gaa='git add --all'
alias gapa='git add --patch'
alias gau='git add --update'
alias gav='git add --verbose'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
alias gwip='git add -A; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
alias gam='git am'
alias gama='git am --abort'
alias gamc='git am --continue'
+31
View File
@@ -112,6 +112,37 @@ plugins=(... hcloud)
| hcst | `hcloud server-type list` | List all server types |
| hcit | `hcloud image list --type system` | List all system images |
## Prompt function
This plugin provides `hcloud_prompt_info` which can be added to your prompt to display the current Hetzner Cloud context.
- If `HCLOUD_TOKEN` environment variable is set, it displays `HCLOUD_TOKEN` (indicating direct token usage)
- Otherwise, it displays the active context name
### Usage
Add `$(hcloud_prompt_info)` to your `PROMPT` or `RPROMPT` in your `.zshrc`:
```zsh
RPROMPT='$(hcloud_prompt_info)'
```
### Theme variables
| Variable | Default | Description |
| :----------------------------- | :-------------- | :----------------------------------------------- |
| `ZSH_THEME_HCLOUD_PREFIX` | `<hcloud:` | Prefix before the context name |
| `ZSH_THEME_HCLOUD_SUFFIX` | `>` | Suffix after the context name |
| `ZSH_THEME_HCLOUD_TOKEN_TEXT` | `HCLOUD_TOKEN` | Text shown when `HCLOUD_TOKEN` env var is set |
### Example with custom styling
```zsh
ZSH_THEME_HCLOUD_PREFIX="%{$fg[blue]%}hcloud:("
ZSH_THEME_HCLOUD_SUFFIX=")%{$reset_color%}"
RPROMPT='$(hcloud_prompt_info)'
```
## Requirements
This plugin requires the [Hetzner Cloud CLI](https://github.com/hetznercloud/cli) to be installed.
+17
View File
@@ -131,3 +131,20 @@ alias hcdc='hcloud datacenter list'
alias hcloc='hcloud location list'
alias hcst='hcloud server-type list'
alias hcit='hcloud image list --type system'
# Prompt function to display current hcloud context
# Usage: add $(hcloud_prompt_info) to your PROMPT or RPROMPT
function hcloud_prompt_info() {
# Check if HCLOUD_TOKEN is set (overrides context)
if [[ -n "$HCLOUD_TOKEN" ]]; then
echo "${ZSH_THEME_HCLOUD_PREFIX=<hcloud:}${ZSH_THEME_HCLOUD_TOKEN_TEXT=HCLOUD_TOKEN}${ZSH_THEME_HCLOUD_SUFFIX=>}"
return
fi
# Get active context
local context
context=$(hcloud context active 2>/dev/null)
[[ -n "$context" ]] || return
echo "${ZSH_THEME_HCLOUD_PREFIX=<hcloud:}${context}${ZSH_THEME_HCLOUD_SUFFIX=>}"
}
+1 -1
View File
@@ -70,7 +70,7 @@ plugins=(... jj)
## Prompt usage
Because `jj` has a very powerful [template syntax](https://martinvonz.github.io/jj/latest/templates/), this
Because `jj` has a very powerful [template syntax](https://docs.jj-vcs.dev/latest/templates/), this
plugin only exposes a convenience function `jj_prompt_template` to read information from the current change.
It is basically the same as `jj log --no-graph -r @ -T $1`:
+1 -2
View File
@@ -86,8 +86,7 @@ print(unquote_plus(sys.stdin.read()))
function pp_json() {
ruby -e '
require "json"
require "yaml"
puts JSON.parse(STDIN.read).to_yaml
puts JSON.pretty_generate(JSON.parse(STDIN.read), indent: " ")
'
}
function is_json() {
@@ -0,0 +1,54 @@
#!/usr/bin/env zsh
# Run with: zsh -df plugins/jsontools/tests/jsontools-ruby.test.zsh
emulate -L zsh
setopt err_return
(( $+commands[ruby] )) || {
print -u2 'These tests require Ruby.'
exit 1
}
JSONTOOLS_METHOD=ruby
source "${0:A:h:h}/jsontools.plugin.zsh"
local test_dir=$(mktemp -d)
check_output() {
local tool=$1 description=$2 expected_status=${3:-0}
local -i result=0
$tool < "$test_dir/input" > "$test_dir/actual" || result=$?
if (( result != expected_status )) \
|| ! cmp -s "$test_dir/expected" "$test_dir/actual"; then
print -u2 -r -- "FAIL: $description ($tool exited $result)"
return 1
fi
print -r -- "PASS: $description"
}
{
# pp_json prints JSON with the same 4-space indent as the node and python3 methods.
print -rn -- '{"value":42}' > "$test_dir/input"
printf '{\n "value": 42\n}\n' > "$test_dir/expected"
check_output pp_json 'pretty-print a small document'
print -rn -- '{"list":[1,"two"],"nested":{"a":null,"b":true}}' > "$test_dir/input"
printf '{\n "list": [\n 1,\n "two"\n ],\n "nested": {\n "a": null,\n "b": true\n }\n}\n' \
> "$test_dir/expected"
check_output pp_json 'pretty-print a nested document'
printf '{"a":1}\n[2]\n' > "$test_dir/input"
printf '{\n "a": 1\n}\n[\n 2\n]\n' > "$test_dir/expected"
check_output pp_ndjson 'pretty-print NDJSON'
print -rn -- '{"value":42}' > "$test_dir/input"
print -r -- true > "$test_dir/expected"
check_output is_json 'validate a document'
print -rn -- '{invalid}' > "$test_dir/input"
print -r -- false > "$test_dir/expected"
check_output is_json 'reject invalid JSON' 1
print 'All jsontools Ruby tests passed.'
} always {
rm -rf -- "$test_dir"
}
+14
View File
@@ -80,3 +80,17 @@ zstyle ':omz:plugins:laravel' php 'herd php'
| `paqr` | `php artisan queue:retry` |
| `paqt` | `php artisan queue:table` |
| `paqw` | `php artisan queue:work` |
## Modules
Aliases for [nWidart/laravel-modules](https://github.com/nWidart/laravel-modules).
| Alias | Description |
|:-:|:-:|
| `pamol` | `php artisan module:list` |
| `pamomk` | `php artisan module:make` |
| `pamoe` | `php artisan module:enable` |
| `pamod` | `php artisan module:disable` |
| `pamom` | `php artisan module:migrate` |
| `pamomr` | `php artisan module:migrate-rollback` |
| `pamos` | `php artisan module:seed` |
+9
View File
@@ -53,4 +53,13 @@ alias paqr="$_omz_laravel_php artisan queue:retry"
alias paqt="$_omz_laravel_php artisan queue:table"
alias paqw="$_omz_laravel_php artisan queue:work"
# Modules (nWidart/laravel-modules)
alias pamol="$_omz_laravel_php artisan module:list"
alias pamomk="$_omz_laravel_php artisan module:make"
alias pamoe="$_omz_laravel_php artisan module:enable"
alias pamod="$_omz_laravel_php artisan module:disable"
alias pamom="$_omz_laravel_php artisan module:migrate"
alias pamomr="$_omz_laravel_php artisan module:migrate-rollback"
alias pamos="$_omz_laravel_php artisan module:seed"
unset _omz_laravel_php
+1
View File
@@ -30,6 +30,7 @@ man-command-line() {
else
BUFFER="man ${args[1]}"
fi
zle end-of-line
}
zle -N man-command-line
+2
View File
@@ -30,6 +30,8 @@ if it's found, or the mvn command otherwise.
| `mvncisto` | `mvn clean install -DskipTests --offline` |
| `mvncom` | `mvn compile` |
| `mvncp` | `mvn clean package` |
| `mvncpst` | `mvn clean package -DskipTests` |
| `mvncpsto` | `mvn clean package -DskipTests --offline` |
| `mvnct` | `mvn clean test` |
| `mvncv` | `mvn clean verify` |
| `mvncvst` | `mvn clean verify -DskipTests` |
+12 -3
View File
@@ -59,6 +59,8 @@ alias mvncist='mvn clean install -DskipTests'
alias mvncisto='mvn clean install -DskipTests --offline'
alias mvncom='mvn compile'
alias mvncp='mvn clean package'
alias mvncpst='mvn clean package -DskipTests'
alias mvncpsto='mvn clean package -DskipTests --offline'
alias mvnct='mvn clean test'
alias mvncv='mvn clean verify'
alias mvncvst='mvn clean verify -DskipTests'
@@ -347,6 +349,13 @@ function listMavenCompletions {
)
}
compctl -K listMavenCompletions mvn mvnw
compctl -K listMavenCompletions mvn-color
compctl -K listMavenCompletions mvn-or-mvnw
# Completion, via compsys so that tools built on it (fzf-tab, etc.) can take over.
_mvn() {
local -a commands
listMavenCompletions
# _describe splits entries on `:`, so escape it to keep goals like `dependency:tree`.
commands=("${(@)reply//:/\\:}")
_describe -t mvn-commands 'mvn command' commands
}
compdef _mvn mvn mvnw mvn-color mvn-or-mvnw
+1 -1
View File
@@ -16,7 +16,7 @@ plugins=(... npm)
| `npmS` | `npm i -S` | Install and save to dependencies in your package.json |
| `npmD` | `npm i -D` | Install and save to dev-dependencies in your package.json |
| `npmF` | `npm i -f` | Force install from remote registries ignoring local cache |
| `npmE` | `PATH="$(npm bin)":"$PATH"` | Run command from node_modules folder based on current directory |
| `npmE` | `PATH="$(npm root)/.bin":"$PATH"` | Run command from node_modules folder based on current directory |
| `npmO` | `npm outdated` | Check which npm modules are outdated |
| `npmU` | `npm update` | Update all the packages listed to the latest version |
| `npmV` | `npm -v` | Check package versions |
+1 -1
View File
@@ -32,7 +32,7 @@ alias npmF='npm i -f'
# Execute command from node_modules folder based on current directory
# i.e npmE gulp
alias npmE='PATH="$(npm bin)":"$PATH"'
alias npmE='PATH="$(npm root)/.bin":"$PATH"'
# Check which npm modules are outdated
alias npmO="npm outdated"
+2 -2
View File
@@ -28,11 +28,11 @@ plugins=(... poetry)
| prm | `poetry remove` | Remove packages from `pyproject.toml` and uninstall them |
| prun | `poetry run` | Executes the given command inside the project’s virtualenv |
| psad | `poetry self add` | Add the Poetry plugin and install dependencies to make it work |
| psh | `poetry shell` | Spawns a shell within the virtual environment. If one doesn’t exist, it will be created |
| psh | `poetry shell` | Spawns a shell within the virtual environment. With Poetry 2.0+ and no shell plugin, activates it with `poetry env activate` |
| pshw | `poetry show` | List all the available dependencies |
| pslt | `poetry show --latest` | List latest version of the dependencies |
| psup | `poetry self update` | Update Poetry to the latest version (default) or to the specified version |
| psync | `poetry install --sync` | Synchronize your environment with the `poetry.lock` |
| psync | `poetry sync` | Synchronize your environment with the `poetry.lock` (`poetry install --sync` before Poetry 2.0) |
| ptree | `poetry show --tree` | List the dependencies as tree |
| pup | `poetry update` | Get the latest versions of the dependencies and to update the `poetry.lock` |
| pvinf | `poetry env info` | Get basic information about the currently activated virtualenv |
+19 -2
View File
@@ -14,11 +14,9 @@ alias ppub='poetry publish'
alias prm='poetry remove'
alias prun='poetry run'
alias psad='poetry self add'
alias psh='poetry shell'
alias pshw='poetry show'
alias pslt='poetry show --latest'
alias psup='poetry self update'
alias psync='poetry install --sync'
alias ptree='poetry show --tree'
alias pup='poetry update'
alias pvinf='poetry env info'
@@ -26,6 +24,25 @@ alias pvoff='poetry config virtualenvs.create false'
alias pvrm='poetry env remove'
alias pvu='poetry env use'
# Poetry 2.0 moved `poetry shell` to the poetry-plugin-shell plugin, so fall
# back to activating the virtualenv in the current shell when it's missing.
function psh {
if poetry shell --help &>/dev/null; then
poetry shell "$@"
else
eval "$(poetry env activate)"
fi
}
# Poetry 2.0 replaced `poetry install --sync` with `poetry sync`.
function psync {
if poetry sync --help &>/dev/null; then
poetry sync "$@"
else
poetry install --sync "$@"
fi
}
# Return immediately if poetry is not found
if (( ! $+commands[poetry] )); then
return
+1 -1
View File
@@ -1,7 +1,7 @@
# Pre-commit plugin
This plugin adds aliases for common commands of [pre-commit](https://pre-commit.com/).
It also supports [prek](https://github.com/prek/prek) as a drop-in replacement.
It also supports [prek](https://github.com/j178/prek) as a drop-in replacement.
If `prek` is available, it will be used; otherwise, `pre-commit` is used as fallback.
To use this plugin, add it to the plugins array in your zshrc file:
+2
View File
@@ -34,6 +34,8 @@ virtual environments:
`<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it (keeps venv activated
in subdirectories).
- To enable the feature, set `PYTHON_AUTO_VRUN=true` before sourcing oh-my-zsh.
- To also search parent directories (useful for monorepos), set `PYTHON_AUTO_VRUN_RECURSIVE=true` as well.
The search stops before `$HOME`, so a venv in your home directory is not activated in every folder under it.
- The plugin activates the first existing virtual environment, in order, appearing in `$PYTHON_VENV_NAMES`.
The default virtual environment name is `venv`. To use a different name, set
`PYTHON_VENV_NAME=<venv-name>`. For example: `PYTHON_VENV_NAME=".venv"`
+16 -1
View File
@@ -113,8 +113,23 @@ if [[ "$PYTHON_AUTO_VRUN" == "true" ]]; then
# make sure we're not in a venv already
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
source $file > /dev/null 2>&1
break
return
done
# Search parent directories if recursive mode is enabled, stopping before $HOME
if [[ "$PYTHON_AUTO_VRUN_RECURSIVE" == "true" ]]; then
local search_dir="$PWD:h"
while [[ "$search_dir" != "/" && "$search_dir" != "." && "$search_dir" != "$HOME" ]]; do
for file in "${search_dir}/"${^PYTHON_VENV_NAMES[@]}"/bin/activate"(N.); do
# the venv found is already active
[[ "${file:h:h:A}" == "${VIRTUAL_ENV:A}" ]] && return
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
source $file > /dev/null 2>&1
return
done
search_dir="${search_dir:h}"
done
fi
fi
}
add-zsh-hook chpwd auto_vrun
+23 -1
View File
@@ -24,7 +24,7 @@ plugins=(... systemd)
| `sc-show-environment` | `systemctl show-environment` | Dump the systemd manager environment block |
| `sc-cat` | `systemctl cat` | Show backing files of one or more units |
| `sc-list-timers` | `systemctl list-timers` | List timer units currently in memory |
| **Aliases with sudo** |||
| **Privileged aliases** |||
| `sc-start` | `sudo systemctl start` | Start Unit(s) |
| `sc-stop` | `sudo systemctl stop` | Stop Unit(s) |
| `sc-reload` | `sudo systemctl reload` | Reload Unit(s) |
@@ -50,6 +50,28 @@ plugins=(... systemd)
| `sc-disable-now` | `sudo systemctl disable --now` | Disable and stop unit(s) |
| `sc-mask-now` | `sudo systemctl mask --now` | Mask and stop unit(s) |
### Privileged aliases
systemd plugin supports alternative privilege elevation tools. You can prepend an arbitrary string,
replacing `sudo`, to the privileged aliases by setting `$ZSH_SYSTEMD_SUDO` variable. You can leave
authorization to systemd by setting `$ZSH_SYSTEMD_SUDO` to an empty string.
To use `doas` as your elevation tool you will need to add the following line to your zshrc;
```zsh
ZSH_SYSTEMD_SUDO="doas"
```
After shell restart, you will see that alias for `sc-enable` is changed:
```sh
$ which sc-enable
sc-enable: aliased to doas systemctl enable
```
These aliases are evaluated during oh-my-zsh startup, and can't be changed interactively (you will
need to restart shell to see changes).
### User aliases
You can use the above aliases as `--user` by using the prefix `scu` instead of `sc`.
+16 -5
View File
@@ -67,15 +67,27 @@ power_commands=(
suspend
)
if ! [[ -v ZSH_SYSTEMD_SUDO ]]; then
ZSH_SYSTEMD_SUDO="sudo"
fi
for c in $user_commands; do
alias "sc-$c"="systemctl $c"
alias "scu-$c"="systemctl --user $c"
done
for c in $sudo_commands; do
alias "sc-$c"="sudo systemctl $c"
alias "scu-$c"="systemctl --user $c"
done
# Avoids leading space in alias when using polkit
if [[ -n "${ZSH_SYSTEMD_SUDO}" ]]; then
for c in $sudo_commands; do
alias "sc-$c"="$ZSH_SYSTEMD_SUDO systemctl $c"
alias "scu-$c"="systemctl --user $c"
done
else
for c in $sudo_commands; do
alias "sc-$c"="systemctl $c"
alias "scu-$c"="systemctl --user $c"
done
fi
for c in $power_commands; do
alias "sc-$c"="systemctl $c"
@@ -83,7 +95,6 @@ done
unset c user_commands sudo_commands power_commands
# --now commands
alias sc-enable-now="sc-enable --now"
alias sc-disable-now="sc-disable --now"
+20
View File
@@ -0,0 +1,20 @@
# talosctl plugin
This plugin adds completion for the [talosctl](https://docs.siderolabs.com/talos/v1.12/learn-more/talosctl) CLI for managing [Talos](https://github.com/siderolabs/talos) Linux.
To use it, add `talosctl` to the plugins array in your zshrc file:
```zsh
plugins=(... talosctl)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script and is automatically updated asynchronously when the plugin is
loaded, which is usually when you start up a new terminal emulator.
The cache is stored at:
- `$ZSH_CACHE/completions/_talosctl` completions script
+18
View File
@@ -0,0 +1,18 @@
# Autocompletion for talosctl
if (( ! $+commands[talosctl] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `talosctl`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_talosctl" ]]; then
typeset -g -A _comps
autoload -Uz _talosctl
_comps[talosctl]=_talosctl
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._talosctl"
zf_mv -f -- =( talosctl completion zsh ) "$ZSH_CACHE_DIR/completions/_talosctl"
} &|
+53
View File
@@ -0,0 +1,53 @@
# Terragrunt plugin
Terragrunt is a thin wrapper for opentofu/terraform that provides extra tools
and features to enhance the management of Infrastructure as Code (IaC) using
opentofu/terraform. This plugin adds completion for `terragrunt` command, as well
as aliases and a prompt function.
To use it, add `terragrunt` to the plugins array of your `~/.zshrc` file:
```shell
plugins=(... terragrunt)
```
## Requirements
- [Terragrunt](https://docs.terragrunt.com/) v0.77.22 or later
## Aliases
| Alias | Command |
| ------ | ----------------------------------------- |
| `tg` | `terragrunt` |
| `tga` | `terragrunt run -- apply` |
| `tgaa` | `terragrunt run -- apply -auto-approve` |
| `tgc` | `terragrunt run -- console` |
| `tgd` | `terragrunt run -- destroy` |
| `tgd!` | `terragrunt run -- destroy -auto-approve` |
| `tgi` | `terragrunt run -- init` |
| `tgo` | `terragrunt run -- output` |
| `tgp` | `terragrunt run -- plan` |
| `tgv` | `terragrunt run -- validate` |
| `tgs` | `terragrunt run -- state` |
| `tgsh` | `terragrunt run -- show` |
| `tgr` | `terragrunt run -- refresh` |
| `tgt` | `terragrunt run -- test` |
| `tgws` | `terragrunt run -- workspace` |
## Prompt function
- `terragrunt_version_prompt_info` shows the current version of the `terragrunt` command.
To use it, add it to a `PROMPT` or `RPROMPT` variable in your theme or `.zshrc` file.
```sh
RPROMPT='$(terragrunt_version_prompt_info)'
```
You can also specify the PREFIX and SUFFIX strings with the following variables.
```sh
ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_SUFFIX="%{$reset_color%}"
```
+27
View File
@@ -0,0 +1,27 @@
# set up the terragrunt completion (compatible for zsh)
autoload -Uz bashcompinit && bashcompinit
complete -C terragrunt terragrunt
# terragrunt version prompt function
function terragrunt_version_prompt_info() {
# get the output of `terragrunt --version` in a single line, and get the third word after splitting by a space
local terragrunt_version=${${(s: :)$(terragrunt --version)}[3]}
# make sure to escape % signs in the version string to prevent command injection
echo "${ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_PREFIX-[}${terragrunt_version:gs/%/%%}${ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_SUFFIX-]}"
}
alias tg='terragrunt'
alias tga='terragrunt run -- apply'
alias tgaa='terragrunt run -- apply -auto-approve'
alias tgc='terragrunt run -- console'
alias tgd='terragrunt run -- destroy'
alias tgd!='terragrunt run -- destroy -auto-approve'
alias tgi='terragrunt run -- init'
alias tgo='terragrunt run -- output'
alias tgp='terragrunt run -- plan'
alias tgv='terragrunt run -- validate'
alias tgs='terragrunt run -- state'
alias tgsh='terragrunt run -- show'
alias tgr='terragrunt run -- refresh'
alias tgt='terragrunt run -- test'
alias tgws='terragrunt run -- workspace'
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env zsh
# Run with: zsh -df plugins/timer/tests/timer.test.zsh
emulate -L zsh
source "${0:A:h:h}/timer.plugin.zsh"
typeset -i failures=0 tests=0
check_duration() {
local precision=$1 duration=$2 expected=$3
local output=$(TIMER_PRECISION=$precision __timer_format_duration $duration)
(( tests++ ))
if [[ $output == "$expected" ]]; then
print -r -- "PASS: $duration with precision $precision -> $output"
else
print -u2 -r -- "FAIL: $duration with precision $precision -> $output (expected $expected)"
(( failures++ ))
fi
}
check_duration 1 0.04 /0.0s
check_duration 1 3.04 /3.0s
check_duration 1 40.0 /40.0s
check_duration 1 59.94 /59.9s
check_duration 1 59.97 /1m0.0s
check_duration 1 61.5 /1m1.5s
check_duration 1 73.0 /1m13.0s
check_duration 1 119.97 /2m0.0s
check_duration 1 3599.99 /60m0.0s
check_duration 2 59.996 /1m0.00s
check_duration 2 0.02 /0.02s
check_duration 0 1.4 /1s
check_duration 0 59.6 /1m0s
check_duration 0 119.5 /2m0s
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
+8 -2
View File
@@ -6,8 +6,14 @@ __timer_current_time() {
}
__timer_format_duration() {
local mins=$(printf '%.0f' $(($(IFS='.' read int dec <<< "$1"; echo $int) / 60)))
local secs=$(printf "%.${TIMER_PRECISION:-1}f" $(($1 - 60 * mins)))
local -i precision=${TIMER_PRECISION:-1}
local -i scale=$(( 10 ** precision ))
# Round to the displayed precision before splitting off the minutes,
# so that e.g. 59.97s is shown as 1m0.0s instead of 60.0s
local -i units
(( units = $1 * scale + 0.5 ))
local -i mins=$(( units / (60 * scale) ))
local secs=$(printf "%.${precision}f" $(( (units - 60 * scale * mins) / (scale * 1.0) )))
local duration_str=$(echo "${mins}m${secs}s")
local format="${TIMER_FORMAT:-/%d}"
echo "${format//\%d/${duration_str#0m}}"
+1
View File
@@ -11,6 +11,7 @@ tldr-command-line() {
args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]})
BUFFER="tldr ${args[1]}"
zle end-of-line
}
zle -N tldr-command-line
+12 -12
View File
@@ -15,18 +15,18 @@ The plugin also supports the following:
## Aliases
| Alias | Command | Description |
| ---------- | -------------------------- | -------------------------------------------------------- |
| `ta` | tmux attach -t | Attach new tmux session to already running named session |
| `tad` | tmux attach -d -t | Detach named tmux session |
| `tds` | `_tmux_directory_session` | Creates or attaches to a session for the current path |
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
| `tksv` | tmux kill-server | Terminate all running tmux sessions |
| `tl` | tmux list-sessions | Displays a list of running tmux sessions |
| `to` | tmux new-session -A -s | Create or attach to a named tmux session |
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
| `tmuxconf` | `$EDITOR $ZSH_TMUX_CONFIG` | Open .tmux.conf file with an editor |
| `ts` | tmux new-session -s | Create a new named tmux session |
| Alias | Command | Description |
| ---------- | -------------------------------------- | -------------------------------------------------------- |
| `ta` | tmux attach -t | Attach new tmux session to already running named session |
| `tad` | tmux attach -d -t | Detach named tmux session |
| `tds` | `_tmux_directory_session` | Creates or attaches to a session for the current path |
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
| `tksv` | tmux kill-server | Terminate all running tmux sessions |
| `tl` | tmux list-sessions | Displays a list of running tmux sessions |
| `to` | tmux new-session -A -s | Create or attach to a named tmux session |
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
| `tmuxconf` | `${(z)EDITOR:-vim} "$ZSH_TMUX_CONFIG"` | Open .tmux.conf file with an editor. |
| `ts` | tmux new-session -s | Create a new named tmux session |
## Configuration Variables
+1 -1
View File
@@ -77,7 +77,7 @@ function _build_tmux_alias {
alias tksv='tmux kill-server'
alias tl='tmux list-sessions'
alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
alias tmuxconf='${(z)EDITOR:-vim} "$ZSH_TMUX_CONFIG"'
_build_tmux_alias "ta" "attach" "-t"
_build_tmux_alias "tad" "attach -d" "-t"
+1 -1
View File
@@ -22,7 +22,7 @@ plugins=(... uv)
| uvlu | `uv lock --upgrade` | Lock the dependencies to the newest compatible versions |
| uvp | `uv pip` | Manage pip packages |
| uvpi | `uv python install` | Install a specific version of python |
| uvpl | `uv python list` | Lists all python version installed |
| uvpl | `uv python list` | List all installed Python versions. |
| uvpp | `uv python pin` | Pin the current project to use a specific Python version |
| uvpu | `uv python uninstall` | Remove a specific version of python |
| uvpy | `uv python` | Manage Python installs |
+9
View File
@@ -39,6 +39,15 @@ plugins=(... vi-mode)
- `VI_MODE_DISABLE_CLIPBOARD`: If set, disables clipboard integration on yank/paste
Clipboard integration keeps put widgets (`p`/`P`) in sync with the system
clipboard, but only while the last copy to the clipboard actually succeeded.
If that copy failed — no `xclip`/`xsel`, Wayland without `wl-clipboard`, a dead
X forwarding over SSH — the clipboard no longer mirrors what you killed inside
the line editor, so puts use the internal kill buffer instead of the stale
clipboard contents. After a failed push, puts keep using the kill buffer only
while the clipboard still holds exactly what it held when the push failed; a
new external copy is picked up again immediately.
## Mode indicators
*Normal mode* is indicated with a red `<<<` mark at the right prompt, when it
+31 -2
View File
@@ -118,6 +118,15 @@ bindkey '^s' history-incremental-search-forward
bindkey '^a' beginning-of-line
bindkey '^e' end-of-line
# Snapshot of the clipboard taken when the most recent push to it failed.
# While the marker is set, put widgets compare the live clipboard against the
# snapshot: unchanged means the clipboard is stale (it never received the
# kill), so the internal CUTBUFFER is used instead. As soon as the clipboard
# differs again - e.g. an external copy - it is trusted immediately, so
# external copies are never lost for longer than the failure itself.
typeset -g _OMZ_VI_CLIPBOARD_STALE=""
typeset -g _OMZ_VI_CLIPBOARD_STALE_SET=""
function wrap_clipboard_widgets() {
# NB: Assume we are the first wrapper and that we only wrap native widgets
# See zsh-autosuggestions.zsh for a more generic and more robust wrapper
@@ -132,13 +141,33 @@ function wrap_clipboard_widgets() {
eval "
function ${wrapped_name}() {
zle .${widget}
printf %s \"\${CUTBUFFER}\" | clipcopy 2>/dev/null || true
# On a failed push, snapshot the clipboard so put widgets can tell
# stale content (which never received this kill) apart from later
# external copies.
if printf %s \"\${CUTBUFFER}\" | clipcopy 2>/dev/null; then
_OMZ_VI_CLIPBOARD_STALE_SET=\"\"
else
_OMZ_VI_CLIPBOARD_STALE=\"\$(clippaste 2>/dev/null)\"
_OMZ_VI_CLIPBOARD_STALE_SET=1
fi
}
"
else
eval "
function ${wrapped_name}() {
CUTBUFFER=\"\$(clippaste 2>/dev/null || echo \$CUTBUFFER)\"
if [[ -n \"\${_OMZ_VI_CLIPBOARD_STALE_SET:-}\" ]]; then
# Last push failed. If the clipboard still matches the snapshot
# taken at the failure, it is stale: keep the internal CUTBUFFER.
# If it differs, an external copy arrived since - trust it again
# and clear the stale state.
local _clip=\"\$(clippaste 2>/dev/null)\"
if [[ \"\$_clip\" != \"\${_OMZ_VI_CLIPBOARD_STALE}\" ]]; then
CUTBUFFER=\"\$_clip\"
_OMZ_VI_CLIPBOARD_STALE_SET=\"\"
fi
else
CUTBUFFER=\"\$(clippaste 2>/dev/null || echo \$CUTBUFFER)\"
fi
zle .${widget}
}
"
-1
View File
@@ -43,7 +43,6 @@ Available search contexts are:
| `wolframalpha` | `https://wolframalpha.com/input?i=` |
| `archive` | `https://web.archive.org/web/*/` |
| `scholar` | `https://scholar.google.com/scholar?q=` |
| `ask` | `https://www.ask.com/web?q=` |
| `youtube` | `https://www.youtube.com/results?search_query=` |
| `deepl` | `https://www.deepl.com/translator#auto/auto/` |
| `dockerhub` | `https://hub.docker.com/search?q=` |
+3 -4
View File
@@ -24,7 +24,6 @@ function web_search() {
wolframalpha "https://www.wolframalpha.com/input/?i="
archive "https://web.archive.org/web/*/"
scholar "https://scholar.google.com/scholar?q="
ask "https://www.ask.com/web?q="
youtube "https://www.youtube.com/results?search_query="
deepl "https://www.deepl.com/translator#auto/auto/"
dockerhub "https://hub.docker.com/search?q="
@@ -54,10 +53,11 @@ function web_search() {
# search or go to main page depending on number of arguments passed
if [[ $# -gt 1 ]]; then
# if search goes in the query string ==> space as +, otherwise %20
# if search goes in the query string ==> space as + and escape reserved
# characters like & and +, otherwise %20
# see https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20
local param="-P"
[[ "$urls[$1]" == *\?*= ]] && param=""
[[ "$urls[$1]" == *\?*= ]] && param="-r"
# build search url:
# join arguments passed with '+', then append to search engine URL
@@ -89,7 +89,6 @@ alias stackoverflow='web_search stackoverflow'
alias wolframalpha='web_search wolframalpha'
alias archive='web_search archive'
alias scholar='web_search scholar'
alias ask='web_search ask'
alias youtube='web_search youtube'
alias deepl='web_search deepl'
alias dockerhub='web_search dockerhub'
+30
View File
@@ -0,0 +1,30 @@
# zsh-patina plugin
Initializes [zsh-patina](https://github.com/michel-kraemer/zsh-patina), a
"blazingly fast Zsh plugin performing syntax highlighting of your command line
while you type 🌈"
The plugin also caches completions for the `zsh-patina` command in
`$ZSH_CACHE_DIR/completions/_zsh-patina`, refreshed each time the plugin loads.
To use it, add `zsh-patina` to the plugins array in your `.zshrc` file:
```zsh
plugins=(... zsh-patina)
```
zsh-patina replaces [zsh-syntax-highlighting](../zsh-syntax-highlighting), so
enable only one of them. If zsh-syntax-highlighting is in the plugins array or
already loaded, this plugin prints a warning and does not activate.
## Binary location
If `zsh-patina` is not in your `PATH` when Oh My Zsh loads (eg: it lives in
`~/.cargo/bin`), set `ZSH_PATINA_BINARY` to its full path before sourcing
Oh My Zsh:
```zsh
ZSH_PATINA_BINARY=$HOME/.cargo/bin/zsh-patina
```
**Note:** you have to [install zsh-patina](https://github.com/michel-kraemer/zsh-patina#how-to-install) first.
+21
View File
@@ -0,0 +1,21 @@
if (( $+ZSH_HIGHLIGHT_VERSION )) || (( ${plugins[(Ie)zsh-syntax-highlighting]} )); then
echo '[oh-my-zsh] zsh-patina conflicts with zsh-syntax-highlighting, please enable only one of them'
elif [[ -x ${ZSH_PATINA_BINARY:-$commands[zsh-patina]} ]]; then
eval "$(${ZSH_PATINA_BINARY:-$commands[zsh-patina]} activate)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `zsh-patina`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_zsh-patina" ]]; then
typeset -g -A _comps
autoload -Uz _zsh-patina
_comps[zsh-patina]=_zsh-patina
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._zsh-patina"
zf_mv -f -- =( "$1" completion ) "$ZSH_CACHE_DIR/completions/_zsh-patina"
} "${ZSH_PATINA_BINARY:-$commands[zsh-patina]}" &|
else
echo '[oh-my-zsh] zsh-patina not found, please install it from https://github.com/michel-kraemer/zsh-patina'
fi
+2 -2
View File
@@ -5,12 +5,12 @@ function my_git_prompt() {
STATUS=""
# is branch ahead?
if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
if $(echo "$(git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
# is branch behind?
if $(echo "$(git log HEAD..origin/$(git_current_branch) 2> /dev/null)" | grep '^commit' &> /dev/null); then
if $(echo "$(git log HEAD..@{upstream} 2> /dev/null)" | grep '^commit' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
fi
Executable → Regular
View File
File mode changed.
+2 -1
View File
@@ -119,12 +119,13 @@ function parse-commit {
}
# Return truncated hash of the reverted commit
# (12 characters, to match the commit hashes from `git log --abbrev=12`)
function commit:is-revert {
local subject="$1" body="$2"
if [[ "$subject" = Revert* && \
"$body" =~ "This reverts commit ([^.]+)\." ]]; then
echo "${match[1]:0:7}"
echo "${match[1]:0:12}"
else
return 1
fi
+1
View File
@@ -528,6 +528,7 @@ print_success() {
"$(fmt_code "$(fmt_link ".zshrc" "file://$zdot/.zshrc" --text)")" \
"file to select plugins, themes, and options."
printf '\n'
printf '%s\n' "${FMT_YELLOW}★${FMT_RESET} Enjoying Oh My Zsh? Star us on $(fmt_link GitHub https://github.com/ohmyzsh/ohmyzsh)"
printf '%s\n' "• Follow along on X ($(fmt_link @ohmyzsh https://x.com/ohmyzsh)) or Bluesky ($(fmt_link @ohmyz.sh https://bsky.app/profile/ohmyz.sh))"
printf '%s\n' "• Questions or ideas? Join the community on $(fmt_link Discord https://discord.gg/ohmyzsh)"
printf '%s\n' "• Help support the project: sponsor us on $(fmt_link "Open Collective" https://opencollective.com/ohmyzsh),"
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env zsh
# Run with: zsh -df tools/tests/changelog.test.zsh
emulate -L zsh
setopt err_return
local changelog="${0:A:h:h}/changelog.sh"
local test_dir=$(mktemp -d) original_dir=$PWD
# Isolate the test repository from the user's git configuration.
export GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_NOSYSTEM=1
export GIT_AUTHOR_NAME=test GIT_AUTHOR_EMAIL=test@example.com
export GIT_COMMITTER_NAME=test GIT_COMMITTER_EMAIL=test@example.com
# check_changelog <description> <until> <since> <patterns...>
# Each pattern must match a line of the output; a leading ! means no line may match it.
check_changelog() {
local description=$1 until=$2 since=$3 pattern
shift 3
local -a lines
lines=("${(@f)$(zsh -f "$changelog" "$until" "$since" --raw)}")
for pattern; do
if [[ $pattern = !* ]]; then
(( ! ${lines[(I)${~pattern#!}]} )) && continue
else
(( ${lines[(I)${~pattern}]} )) && continue
fi
print -u2 -r -- "FAIL: $description (pattern: $pattern)"
print -u2 -rl -- $lines
return 1
done
print -r -- "PASS: $description"
}
{
builtin cd "$test_dir"
command git init -q
command git commit -q --allow-empty -m 'chore: initial commit'
print demo > demo && command git add demo
command git commit -q -m 'feat(demo): add a demo feature'
print core > core && command git add core
command git commit -q -m 'fix(core): fix an unrelated bug'
command git revert --no-edit HEAD~1 >/dev/null
check_changelog 'hide a reverted commit and its revert' HEAD HEAD~3 \
'*Fix an unrelated bug' '!*Add a demo feature' '!*Revert *'
check_changelog 'keep a revert whose reverted commit is not in the range' HEAD HEAD~2 \
'*Fix an unrelated bug' '*Revert "feat\(demo\): add a demo feature"'
check_changelog 'keep a commit that has not been reverted yet' HEAD~1 HEAD~3 \
'*Add a demo feature' '*Fix an unrelated bug'
print 'All changelog tests passed.'
} always {
builtin cd "$original_dir"
rm -rf -- "$test_dir"
}
+3
View File
@@ -311,6 +311,9 @@ if perform_update; then
printf '%s %s %s %s /____/ %s %s %s %s\n' $RAINBOW $RESET
printf '\n'
printf "${BLUE}%s${RESET}\n\n" "$message"
printf "${YELLOW}${BOLD}★${RESET} ${BLUE}${BOLD}%s %s${RESET}\n" \
"Enjoying Oh My Zsh? Star us on" \
"$(fmt_link GitHub https://github.com/ohmyzsh/ohmyzsh)"
printf "${BLUE}${BOLD}%s %s %s %s${RESET}\n" \
"Follow along on X" "($(fmt_link @ohmyzsh https://x.com/ohmyzsh))" \
"or Bluesky" "($(fmt_link @ohmyz.sh https://bsky.app/profile/ohmyz.sh))"