Compare commits

...
Author SHA1 Message Date
Robby RussellandClaude Opus 5.5 34aec8b799 docs(lib): note why the omz autoloads need -z under kshautoload
The autoload files end with a call to the function they define. Under
kshautoload, ksh-style loading would call it a second time; -z forces
zsh-style loading so the trailing call is the only one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 11:44:09 -08:00
copilot-swe-agent[bot]androbbyrussell 82bfc95f7f ci: check syntax for functions/* and completions/_*
Co-authored-by: robbyrussell <257+robbyrussell@users.noreply.github.com>
2026-11-24 11:43:34 -08:00
Robby RussellandClaude Fable 5.1 58d76b0c10 perf(lib): autoload the omz CLI and omz_diagnostic_dump
lib/cli.zsh (944 lines) and lib/diagnostics.zsh (353 lines) were parsed
on every startup to define functions that most shells never call. Move
them to $ZSH/functions/, which is already on $fpath, and autoload the
two entry points from oh-my-zsh.sh instead. The `omz` completion moves
to $ZSH/completions/_omz where compinit picks it up on its own.

Measured on macOS arm64, zsh 5.9: ~1.7 ms less per interactive start.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-24 11:43:34 -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
dependabot[bot] d2b7f557cc chore(deps): bump certifi (#14212)
Bumps the py-minor group in /.github/workflows/dependencies with 1 update: [certifi](https://github.com/certifi/python-certifi).


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

---
updated-dependencies:
- dependency-name: certifi
  dependency-version: 2026.10.19
  dependency-type: direct:production
  update-type: version-update:semver-minor
  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-10-25 15:39:31 +01:00
dependabot[bot] c61578a8d2 chore(deps): bump the gha-minor group with 3 updates (#14213)
Bumps the gha-minor group with 3 updates: [step-security/harden-runner](https://github.com/step-security/harden-runner), [actions/setup-python](https://github.com/actions/setup-python) and [github/codeql-action/upload-sarif](https://github.com/github/codeql-action).


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

Updates `actions/setup-python` from 7.0.0 to 7.1.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/5fda3b95a4ea91299a34e894583c3862153e4b97...6d4fd22b20465ccc0f7354476588e8df7c9ca0e0)

Updates `github/codeql-action/upload-sarif` from 4.39.0 to 4.39.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee...9b3254085494b55a0f7c4c2b3d2d52cc712ce370)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.22.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gha-minor
- dependency-name: actions/setup-python
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gha-minor
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.39.1
  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-10-25 15:38:34 +01:00
Robby Russell 2100c630ba feat(bridgetown)!: update aliases for current CLI (#14197)
BREAKING CHANGE: aliases updated for the latest bridgetown version (2.2.2). Check out the plugin README for the changes.
2026-10-21 12:31:14 +02:00
mattmc3andCarlo Sala 0eeaa529bb feat(git-commit): use git-dash commands (#12628)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-10-20 11:44:08 +02:00
dependabot[bot] f888be4bec chore(deps): bump the gha-minor group with 3 updates (#14193)
Signed-off-by: dependabot[bot] <support@github.com>
2026-10-20 11:26:42 +02:00
umutcagand 0650a25040 fix(jsontools): read Node.js input from stdin (#14190) 2026-10-19 17:21:44 -07:00
umutcagand 741642d7a9 fix(extract): preserve .lzma and .Z source files (#14191) 2026-10-19 17:21:39 -07:00
Aurantium🍊 84038f144d docs(uv): correct project initialization descriptions (#14184) 2026-10-19 17:21:08 -07:00
冰水泡枸杞andMarkus Towara a208c3a27a fix(docker): create completions cache dir if missing (#14188)
Closes #13679

Co-Authored-By: Markus Towara <mtowara@gmail.com>
2026-10-19 17:17:06 -07:00
Lichao Chen b056a436fe fix(sfdx): remove duplicated 'for' in completion description (#14195)
Signed-off-by: Lichao Chen <lichao_chen@outlook.com>
2026-10-19 17:13:28 -07:00
Robby RussellandCarlo Sala 964ddf789b feat(cli): add Shellsavers terminal animations (#14167)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-10-13 11:22:24 +02:00
John D Pell fab613bd93 fix(termsupport): improve Apple Terminal support (#14172) 2026-10-13 10:41:24 +02:00
Robby Russell 1e3960e6f9 feat(opencode): add completion and opc aliases (#14082) 2026-10-13 10:40:23 +02:00
dependabot[bot] cbf4a572ef chore(deps): bump the gha-minor group with 3 updates (#14176)
Bumps the gha-minor group with 3 updates: [step-security/harden-runner](https://github.com/step-security/harden-runner), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [github/codeql-action/upload-sarif](https://github.com/github/codeql-action).


Updates `step-security/harden-runner` from 2.21.1 to 2.22.1
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/e14015d583714f6e62063499dc959a02595150a1...ccd8616d44fd3846e67624a50d5aad6d37bf2d25)

Updates `actions/upload-artifact` from 7.0.1 to 7.0.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/043fb46d1a93c77aae656e7c1c64a875d1fc6a0a...cf430e030ddbb5b0abf93d22962f4752f3646cd9)

Updates `github/codeql-action/upload-sarif` from 4.38.2 to 4.38.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...24c54180a607b1449ed407dd24f251e4e9147c8d)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.22.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gha-minor
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gha-minor
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.38.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-10-13 10:38:57 +02:00
Piotr Minkina 55c9071ee7 feat(docker-compose): add aliases for --watch (#13203) 2026-10-13 10:36:54 +02:00
Rik Wanders 083c339e06 feat(git): add gshs alias for git show --stat (#13249) 2026-10-12 03:55:10 -07:00
Masafumi Koba 417c814e2e feat(rbenv): provide completion for rbenv command (#12891)
Ref https://github.com/rbenv/rbenv/#shell-completions
2026-10-12 03:47:39 -07:00
Pete Johns 7d34868725 perf(mise): regenerate completion only when stale (#13759) 2026-10-12 03:34:33 -07:00
Inkyu Oh 106f9874a2 fix(updater): accept Korean IME 'ㅛ' as yes in update prompt (#13791)
On the Korean Dubeolsik keyboard layout, the Y key position produces ㅛ
(U+315B) when a Korean IME is active. Since the update confirmation prompt
only matched [yY$'\n'], Korean users who pressed the Y key with the IME on
had their update silently cancelled. Accept ㅛ as an affirmative answer.
2026-10-11 16:39:36 -07:00
Kunpeng Xie eb29cdb33a fix(globalias): preserve quoted words and assignment values (#14092)
Only invoke alias completion when the complete shell word is an alias name. Completion otherwise treats assignment values and quoted text as standalone alias names, corrupting inputs such as DEBUG=1.

Add a real ZLE regression test covering the reported assignments, quotes, escaped aliases, filtering, and existing expansion behavior.

Assisted-by: OpenAI Codex
2026-10-11 15:58:22 -07:00
Martin MeyerandClaude Opus 5.5 535aaaf924 feat(gpg-agent): add ssh-support style to skip the gpgconf check (#14171)
The plugin runs `gpgconf --list-options gpg-agent` on every shell start
to learn whether `enable-ssh-support` is set. On macOS with GnuPG 2.5.24
that one command takes about 600 ms.

The `ssh-support` style lets the user state the answer instead. With
`no` the plugin sets `GPG_TTY` and stops. That also skips the preexec
hook, which runs `gpg-connect-agent updatestartuptty` before every
command and is only needed for ssh support. With `yes` the plugin sets
`SSH_AUTH_SOCK` without asking.

Left unset, the plugin detects as before, so existing setups do not
change.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 15:46:27 -07:00
Aryan 05c2cb0b2b fix(ruby): preserve special characters in rfind filenames (#14173) 2026-10-11 15:46:21 -07:00
Aryan bd9fb5231b docs(ruby): include -run in the rserver example (#14174) 2026-10-11 15:40:40 -07:00
ohmyzsh[bot] 48feb570f7 chore(zsh-syntax-highlighting): update to e6683f20 (#14175)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2026-10-11 10:27:56 +02:00
Ken van der Eerden 42a4ccb1b1 feat(laravel): add setting to override the php command (#14146)
Aliases always ran `php artisan`, so users of Laravel Herd (`herd php`)
or a versioned binary (`php8.4`) couldn't use them. The new
`zstyle ':omz:plugins:laravel' php` setting replaces `php` in every
alias; without it the aliases are unchanged.
2026-10-09 07:11:17 -07:00
Minh Vu 2d833b453d fix(copyfile): stop on clipboard failure (#14154) 2026-10-09 07:03:29 -07:00
dhairya d7aca552b3 fix(extract): preserve bzip2 archives and honor extraction destination (#14152) 2026-10-09 07:01:26 -07:00
Rasmus Skovgaard Lauritsen 9f9b28a13d feat(logcli): add completion plugin (#14158) 2026-10-08 16:49:20 -07:00
Zhiqi Zhang 361fb5c1ac fix(python): match two-digit minor versions in pyuserpaths (#14161)
The version pattern used the shortest match (#), so "Python 3.11.4"
was truncated to 3.1 and the ~/.local/lib/python3.11/site-packages
check never matched on python >= 3.10, leaving pyuserpaths a no-op.
Use a longest match (##) so the whole minor version is kept.
2026-10-08 16:46:10 -07:00
tuzi3040 3d9b557be3 fix(battery): make macOS regexes compatible with GNU grep (#14163)
* fix(battery): remove unnecessary whitespace escapes in macOS battery parsing

Remove unnecessary `\ ` escapes in the macOS battery plugin's `grep` and `sed` expressions.

* fix(battery): replace \d with [0-9] for GNU grep compatibility
2026-10-08 16:45:21 -07:00
JackLee992 60c9a7a839 fix(emacs): resolve "closing brace expected" syntax error (#14157)
Fixes #14156
2026-10-06 11:06:45 +02:00
ohmyzsh[bot] d745fbf3bd chore(z): update to 7f8ff4df (#14153)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2026-10-05 08:03:11 +02:00
dependabot[bot] 277993de0a chore(deps): bump charset-normalizer (#14155)
Bumps the py-minor group in /.github/workflows/dependencies with 1 update: [charset-normalizer](https://github.com/jawah/charset_normalizer).


Updates `charset-normalizer` from 3.5.1 to 3.5.2
- [Release notes](https://github.com/jawah/charset_normalizer/releases)
- [Changelog](https://github.com/jawah/charset_normalizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jawah/charset_normalizer/compare/3.5.1...3.5.2)

---
updated-dependencies:
- dependency-name: charset-normalizer
  dependency-version: 3.5.2
  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-10-05 08:02:35 +02:00
ca0904 4d4cfc287e fix(universalarchive): support 7zz and 7z for 7z archives (#14147) 2026-09-29 17:38:41 +02:00
Haakon Meihack 92bf53f1ae fix(emacs): do not emit ANSI escape codes in ghostel (#14145) 2026-09-29 11:23:20 +02:00
Chetan Agrawal 5c4bb4aec5 fix(extract): support 7zz and 7z for 7z archives (#14144) 2026-09-29 11:20:42 +02:00
nervo 868da9cfd5 fix(sops): correct completion command (#14139) 2026-09-29 08:13:36 +02:00
Martin Delille 83a0ec79ee feat(git): add aliases related to log, rebase and submodules (#9676)
* Add glom: git log --oneline --decorate --color $(git_main_branch)
* Add gsuri: git submodule update --recursive --init
* Add grbmi/grbmia: git rebase $(git_main_branch) --interactive / --autosquash
2026-09-28 13:22:49 +02:00
Robby RussellandCarlo Sala c5852b1101 refactor(github)!: deprecate legacy hub plugin (#14089)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-09-28 10:33:33 +02:00
nervo 68795c2170 feat(sops): introduce plugin (#14120) 2026-09-28 10:24:35 +02:00
Felix Bühler f809d46c10 fix(lib): protect omz_urlencode from global aliases (#14128) 2026-09-28 09:44:06 +02:00
Mingyang WuandCarlo Sala 0431f1c33d fix(emacs): create a frame for empty launcher invocations (#14091)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-09-28 09:41:06 +02:00
Kunal Gangakhedkar a3c88eba72 feat(git): add alias gsnut (#14124)
Signed-off-by: Kunal Gangakhedkar <kunal.gangakhedkar@gmail.com>
2026-09-28 09:37:28 +02:00
dependabot[bot] 6881f37316 chore(deps): bump github/codeql-action/upload-sarif (#14135)
Bumps the gha-minor group with 1 update: [github/codeql-action/upload-sarif](https://github.com/github/codeql-action).


Updates `github/codeql-action/upload-sarif` from 4.38.0 to 4.38.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/b96794f015dfd88f77b49b1c93e0fa7110f94c63...2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2)

---
updated-dependencies:
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.38.2
  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-09-28 09:11:58 +02:00
dependabot[bot] 1d66682636 chore(deps): bump idna (#14134)
Bumps the py-minor group in /.github/workflows/dependencies with 1 update: [idna](https://github.com/kjd/idna).


Updates `idna` from 3.19 to 3.20
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md)
- [Commits](https://github.com/kjd/idna/compare/v3.19...v3.20)

---
updated-dependencies:
- dependency-name: idna
  dependency-version: '3.20'
  dependency-type: direct:production
  update-type: version-update:semver-minor
  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-09-28 09:11:33 +02:00
ohmyzsh[bot] ce7f8c3224 chore(kube-ps1): update to 7aaaeee5 (#14133)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2026-09-28 09:11:09 +02:00
ohmyzsh[bot] f8e13d714e chore(gradle): update to 05693a01 (#14132)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2026-09-28 09:10:38 +02:00
Asanali 95ba6ae764 fix: hide temp completion files from $fpath (#14126)
Closes #14125
2026-09-27 23:26:18 +02:00
157 changed files with 2372 additions and 541 deletions

No files matched your search

+4 -4
View File
@@ -12,7 +12,7 @@ dependencies:
plugins/gradle: plugins/gradle:
repo: gradle/gradle-completion repo: gradle/gradle-completion
branch: master branch: master
version: e7c881dbef7462bc35ad05328397e1582fe25cb8 version: 05693a01fcb246bc4e8fc32a8d561dc537aaedf2
precopy: | precopy: |
set -e set -e
find . ! -name _gradle ! -name LICENSE -delete find . ! -name _gradle ! -name LICENSE -delete
@@ -30,7 +30,7 @@ dependencies:
plugins/kube-ps1: plugins/kube-ps1:
repo: jonmosco/kube-ps1 repo: jonmosco/kube-ps1
branch: master branch: master
version: b4cd09ec8d4dc007173e28da40aeebf8eff8c87f version: 7aaaeee5eaa29f920acd850ea63839d9f87b8ac5
precopy: | precopy: |
set -e set -e
find . ! -name kube-ps1.sh ! -name LICENSE ! -name README.md -delete find . ! -name kube-ps1.sh ! -name LICENSE ! -name README.md -delete
@@ -46,7 +46,7 @@ dependencies:
plugins/z: plugins/z:
branch: master branch: master
repo: agkozak/zsh-z repo: agkozak/zsh-z
version: 102fb78036ed76feedf623907483691777a1d510 version: 7f8ff4df11b50a14e3666c7cd212baa399c9b92a
precopy: | precopy: |
set -e set -e
rm -r tests rm -r tests
@@ -75,7 +75,7 @@ dependencies:
plugins/zsh-syntax-highlighting: plugins/zsh-syntax-highlighting:
repo: zsh-users/zsh-syntax-highlighting repo: zsh-users/zsh-syntax-highlighting
branch: master branch: master
version: 2fc57d63067c18b1100ecdbf684fa5baf49459d1 version: e6683f20e5c38d3e5447f45845d04ddda75d0f23
precopy: | precopy: |
set -e set -e
version=$(<.version) version=$(<.version)
+3 -3
View File
@@ -16,7 +16,7 @@ jobs:
contents: write # this is needed to push commits and branches contents: write # this is needed to push commits and branches
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
@@ -26,12 +26,12 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Authenticate as @ohmyzsh - name: Authenticate as @ohmyzsh
id: generate-token id: generate-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with: with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }} client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
- name: Setup Python - name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with: with:
python-version: "3.12" python-version: "3.12"
cache: "pip" cache: "pip"
@@ -1,7 +1,7 @@
certifi==2026.7.22 certifi==2026.10.23
charset-normalizer==3.5.1 charset-normalizer==3.5.2
idna==3.19 idna==3.20
PyYAML==6.0.3 PyYAML==6.0.3
requests==2.34.2 requests==2.34.2
semver==3.1.0 semver==3.1.2
urllib3==2.8.0 urllib3==2.8.0
+2 -2
View File
@@ -26,7 +26,7 @@ jobs:
- macos-latest - macos-latest
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
@@ -47,7 +47,7 @@ jobs:
- test - test
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
+3 -1
View File
@@ -24,7 +24,7 @@ jobs:
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
@@ -36,6 +36,8 @@ jobs:
run: | run: |
for file in ./oh-my-zsh.sh \ for file in ./oh-my-zsh.sh \
./lib/*.zsh \ ./lib/*.zsh \
./functions/* \
./completions/_* \
./plugins/*/*.plugin.zsh \ ./plugins/*/*.plugin.zsh \
./plugins/*/_* \ ./plugins/*/_* \
./themes/*.zsh-theme; do ./themes/*.zsh-theme; do
+2 -2
View File
@@ -17,12 +17,12 @@ jobs:
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
- name: Authenticate as @ohmyzsh - name: Authenticate as @ohmyzsh
id: generate-token id: generate-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with: with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }} client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
+4 -4
View File
@@ -36,7 +36,7 @@ jobs:
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with: with:
egress-policy: audit egress-policy: audit
@@ -46,20 +46,20 @@ jobs:
persist-credentials: false persist-credentials: false
- name: "Run analysis" - name: "Run analysis"
uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc # v2.4.4 uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0
with: with:
results_file: results.sarif results_file: results.sarif
results_format: sarif results_format: sarif
publish_results: true publish_results: true
- name: "Upload artifact" - name: "Upload artifact"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with: with:
name: SARIF file name: SARIF file
path: results.sarif path: results.sarif
retention-days: 5 retention-days: 5
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0 uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with: with:
sarif_file: results.sarif sarif_file: results.sarif
+42
View File
@@ -45,6 +45,7 @@ Twitter), and join us on [Discord](https://discord.gg/ohmyzsh).
- [Using Plugins](#using-plugins) - [Using Plugins](#using-plugins)
- [Themes](#themes) - [Themes](#themes)
- [Selecting A Theme](#selecting-a-theme) - [Selecting A Theme](#selecting-a-theme)
- [Shellsavers](#shellsavers)
- [FAQ](#faq) - [FAQ](#faq)
- [Advanced Topics](#advanced-topics) - [Advanced Topics](#advanced-topics)
- [Advanced Installation](#advanced-installation) - [Advanced Installation](#advanced-installation)
@@ -241,6 +242,33 @@ If you only know which themes you don't like, you can add them similarly to an i
ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod) ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)
``` ```
### Shellsavers
Give your terminal a little downtime with `omz shellsaver`—our playful name for
terminal screensavers. The aquarium is the default; choose another scene to change the mood:
```zsh
omz shellsaver # A quiet aquarium full of sea shells
omz shellsaver logo # The updater's rainbow logo, bouncing around
omz shellsaver hermit # A slightly lost hermit crab
omz shellsaver party # A rainbow stage and a dancing crowd
```
Press any key or Ctrl-C to return to your shell. Screensavers run only when invoked
and restore the terminal when they exit. No plugin or configuration change is needed.
Use `omz help` to discover the command, and Tab to complete scene names and options.
```zsh
omz shellsaver aquarium --seconds 30 # Stop automatically after 30 seconds
omz shellsaver logo --mono # Use the terminal's foreground color
omz shellsaver --list # List scenes (aquarium is the default)
omz shellsaver --help # Show all scenes and options
```
Requires Zsh 5.8 or newer, `stty`, and an xterm-compatible terminal with alternate-screen
support. No additional animation package is required. `NO_COLOR` is respected.
A window of at least 49 columns by 18 rows is recommended.
### FAQ ### FAQ
If you have some more questions or issues, you might find a solution in our If you have some more questions or issues, you might find a solution in our
@@ -524,6 +552,20 @@ omz update
Magic! 🎉 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 ## Uninstalling Oh My Zsh
Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup. Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup.
+104
View File
@@ -0,0 +1,104 @@
#compdef 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'
'reload:Reload the current zsh session'
'shellsaver:Launch a whimsical terminal screensaver'
'shop:Open the Oh My Zsh shop'
'theme:Manage themes'
'update:Update Oh My Zsh'
'version:Show the version'
)
if [[ "$words[2]" == (screensaver|shellsaver) ]] && (( CURRENT > 2 )); then
_arguments \
'1:command:' \
'2::scene:(aquarium logo hermit party)' \
'--list[List available scenes]' \
'--mono[Use the default foreground color]' \
'--seconds[Exit after a number of seconds]:seconds:' \
'--snapshot[Print a plain-text still]::frame:' \
'--help[Show Shellsaver help]'
return
fi
if (( CURRENT == 2 )); then
_describe 'command' cmds
elif (( CURRENT == 3 )); then
case "$words[2]" in
changelog) local -a refs
refs=("${(@f)$(builtin cd -q "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
_describe 'command' refs ;;
plugin) subcmds=(
'disable:Disable plugin(s)'
'enable:Enable plugin(s)'
'info:Get plugin information'
'list:List plugins'
'load:Load plugin(s)'
)
_describe 'command' subcmds ;;
pr) subcmds=('clean:Delete all Pull Request branches' 'test:Test a Pull Request')
_describe 'command' subcmds ;;
theme) subcmds=('list:List themes' 'set:Set a theme in your .zshrc file' 'use:Load a theme')
_describe 'command' subcmds ;;
esac
elif (( CURRENT == 4 )); then
case "${words[2]}::${words[3]}" in
plugin::(disable|enable|load))
local -aU valid_plugins
if [[ "${words[3]}" = disable ]]; then
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
_describe 'plugin' valid_plugins ;;
plugin::info)
local -aU plugins
plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
_describe 'plugin' plugins ;;
plugin::list)
local -a opts
opts=('--enabled:List enabled plugins only')
_describe -o 'options' opts ;;
theme::(set|use))
local -aU themes
themes=("$ZSH"/themes/*.zsh-theme(-.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(-.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
_describe 'theme' themes ;;
esac
elif (( CURRENT > 4 )); then
case "${words[2]}::${words[3]}" in
plugin::(enable|disable|load))
local -aU valid_plugins
if [[ "${words[3]}" = disable ]]; then
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
# Remove plugins already passed as arguments
# NOTE: $(( CURRENT - 1 )) is the last plugin argument completely passed, i.e. that which
# has a space after them. This is to avoid removing plugins partially passed, which makes
# the completion not add a space after the completed plugin.
local -a args
args=(${words[4,$(( CURRENT - 1))]})
valid_plugins=(${valid_plugins:|args})
_describe 'plugin' valid_plugins ;;
esac
fi
return 0
+36 -98
View File
@@ -1,5 +1,3 @@
#!/usr/bin/env zsh
function omz { function omz {
setopt localoptions noksharrays setopt localoptions noksharrays
[[ $# -gt 0 ]] || { [[ $# -gt 0 ]] || {
@@ -20,102 +18,6 @@ function omz {
_omz::$command "$@" _omz::$command "$@"
} }
function _omz {
local -a cmds subcmds
cmds=(
'changelog:Print the changelog'
'help:Usage information'
'plugin:Manage plugins'
'pr:Manage Oh My Zsh Pull Requests'
'reload:Reload the current zsh session'
'shop:Open the Oh My Zsh shop'
'theme:Manage themes'
'update:Update Oh My Zsh'
'version:Show the version'
)
if (( CURRENT == 2 )); then
_describe 'command' cmds
elif (( CURRENT == 3 )); then
case "$words[2]" in
changelog) local -a refs
refs=("${(@f)$(builtin cd -q "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
_describe 'command' refs ;;
plugin) subcmds=(
'disable:Disable plugin(s)'
'enable:Enable plugin(s)'
'info:Get plugin information'
'list:List plugins'
'load:Load plugin(s)'
)
_describe 'command' subcmds ;;
pr) subcmds=('clean:Delete all Pull Request branches' 'test:Test a Pull Request')
_describe 'command' subcmds ;;
theme) subcmds=('list:List themes' 'set:Set a theme in your .zshrc file' 'use:Load a theme')
_describe 'command' subcmds ;;
esac
elif (( CURRENT == 4 )); then
case "${words[2]}::${words[3]}" in
plugin::(disable|enable|load))
local -aU valid_plugins
if [[ "${words[3]}" = disable ]]; then
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
_describe 'plugin' valid_plugins ;;
plugin::info)
local -aU plugins
plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
_describe 'plugin' plugins ;;
plugin::list)
local -a opts
opts=('--enabled:List enabled plugins only')
_describe -o 'options' opts ;;
theme::(set|use))
local -aU themes
themes=("$ZSH"/themes/*.zsh-theme(-.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(-.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
_describe 'theme' themes ;;
esac
elif (( CURRENT > 4 )); then
case "${words[2]}::${words[3]}" in
plugin::(enable|disable|load))
local -aU valid_plugins
if [[ "${words[3]}" = disable ]]; then
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
# Remove plugins already passed as arguments
# NOTE: $(( CURRENT - 1 )) is the last plugin argument completely passed, i.e. that which
# has a space after them. This is to avoid removing plugins partially passed, which makes
# the completion not add a space after the completed plugin.
local -a args
args=(${words[4,$(( CURRENT - 1))]})
valid_plugins=(${valid_plugins:|args})
_describe 'plugin' valid_plugins ;;
esac
fi
return 0
}
# If run from a script, do not set the completion function
if (( ${+functions[compdef]} )); then
compdef _omz omz
fi
## Utility functions ## Utility functions
function _omz::confirm { function _omz::confirm {
@@ -163,17 +65,42 @@ function _omz::log {
## User-facing commands ## 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 { function _omz::help {
cat >&2 <<EOF cat >&2 <<EOF
Usage: omz <command> [options] Usage: omz <command> [options]
Available commands: Available commands:
diagnose Run configuration diagnostics
help Print this help message help Print this help message
changelog Print the changelog changelog Print the changelog
plugin <command> Manage plugins plugin <command> Manage plugins
pr <command> Manage Oh My Zsh Pull Requests pr <command> Manage Oh My Zsh Pull Requests
reload Reload the current zsh session reload Reload the current zsh session
shellsaver [scene] Launch a Shellsaver (aquarium by default)
shop Open the Oh My Zsh shop shop Open the Oh My Zsh shop
theme <command> Manage themes theme <command> Manage themes
update Update Oh My Zsh update Update Oh My Zsh
@@ -182,6 +109,15 @@ Available commands:
EOF EOF
} }
function _omz::shellsaver {
command zsh -f "$ZSH/tools/shellsaver.zsh" "$@"
}
# Hidden alias; only shellsaver is advertised in help and command completion.
function _omz::screensaver {
_omz::shellsaver "$@"
}
function _omz::changelog { function _omz::changelog {
local version=${1:-HEAD} format=${3:-"--text"} local version=${1:-HEAD} format=${3:-"--text"}
@@ -951,3 +887,5 @@ function _omz::version {
printf "%s (%s)\n" "$version" "$commit" printf "%s (%s)\n" "$version" "$commit"
) )
} }
omz "$@"
@@ -1,4 +1,4 @@
# diagnostics.zsh # omz_diagnostic_dump
# #
# Diagnostic and debugging support for oh-my-zsh # Diagnostic and debugging support for oh-my-zsh
@@ -351,3 +351,5 @@ function _omz_diag_dump_os_specific_version() {
done done
} }
omz_diagnostic_dump "$@"
+4 -1
View File
@@ -59,7 +59,10 @@ function detect-clipboard() {
function clippaste() { cat /dev/clipboard; } function clippaste() { cat /dev/clipboard; }
elif (( $+commands[clip.exe] )) && (( $+commands[powershell.exe] )); then elif (( $+commands[clip.exe] )) && (( $+commands[powershell.exe] )); then
function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; } 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 elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; } function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
function clippaste() { wl-paste --no-newline; } function clippaste() { wl-paste --no-newline; }
+2 -1
View File
@@ -178,7 +178,8 @@ function omz_urlencode() {
setopt norematchpcre setopt norematchpcre
local -a opts local -a opts
zparseopts -D -E -a opts r m P # Quote the specs so global aliases (e.g. common-aliases' P) don't expand here
zparseopts -D -E -a opts 'r' 'm' 'P'
local in_str="$@" local in_str="$@"
local url_str="" local url_str=""
+7 -5
View File
@@ -5,7 +5,6 @@
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 # See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
# Fully supports screen, iterm, and probably most modern xterm and rxvt # Fully supports screen, iterm, and probably most modern xterm and rxvt
# (In screen, only short_tab_title is used) # (In screen, only short_tab_title is used)
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
function title { function title {
setopt localoptions nopromptsubst setopt localoptions nopromptsubst
@@ -17,7 +16,7 @@ function title {
: ${2=$1} : ${2=$1}
case "$TERM" in case "$TERM" in
cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*|wezterm*) cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty*|st*|foot*|contour*|wezterm*|nsterm*)
print -Pn "\e]2;${2:q}\a" # set window name print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;${1:q}\a" # set tab name print -Pn "\e]1;${1:q}\a" # set tab name
;; ;;
@@ -26,10 +25,12 @@ function title {
print -Pn "\ek${1:q}\e\\" # set screen hardstatus/tmux window name if `allow-rename` is on print -Pn "\ek${1:q}\e\\" # set screen hardstatus/tmux window name if `allow-rename` is on
;; ;;
*) *)
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then case "$TERM_PROGRAM" in
"iTerm.app"|"Apple_Terminal")
print -Pn "\e]2;${2:q}\a" # set window name print -Pn "\e]2;${2:q}\a" # set window name
print -Pn "\e]1;${1:q}\a" # set tab name print -Pn "\e]1;${1:q}\a" # set tab name
else ;;
*)
# Try to use terminfo to set the title if the feature is available # Try to use terminfo to set the title if the feature is available
if (( ${+terminfo[fsl]} && ${+terminfo[tsl]} )); then if (( ${+terminfo[fsl]} && ${+terminfo[tsl]} )); then
# Emit the capabilities with echoti so terminfo does its own parameter # Emit the capabilities with echoti so terminfo does its own parameter
@@ -39,7 +40,8 @@ function title {
print -Pn "$1" print -Pn "$1"
echoti fsl echoti fsl
fi fi
fi ;;
esac
;; ;;
esac esac
} }
+4
View File
@@ -78,6 +78,10 @@ fpath=($ZSH/{functions,completions} $ZSH_CUSTOM/{functions,completions} $fpath)
# Load all stock functions (from $fpath files) called below. # Load all stock functions (from $fpath files) called below.
autoload -U compaudit compinit zrecompile autoload -U compaudit compinit zrecompile
# The omz CLI and omz_diagnostic_dump are loaded on first use; -z keeps
# zsh-style loading under kshautoload so the trailing call runs once
autoload -Uz omz omz_diagnostic_dump
is_plugin() { is_plugin() {
local base_dir=$1 local base_dir=$1
local name=$2 local name=$2
+2 -2
View File
@@ -11,8 +11,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_op" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._op"
zf_mv -f -- =( op completion zsh ) "$TMPPREFIX" zf_mv -f -- =( op completion zsh ) "$ZSH_CACHE_DIR/completions/_op"
} &| } &|
# Load opswd function # Load opswd function
+9 -5
View File
@@ -1,5 +1,5 @@
alias-finder() { alias-finder() {
local cmd=" " exact="" longer="" cheaper="" wordEnd="'?$" finder="" filter="" local c="" cmd=" " exact="" longer="" cheaper="" wordEnd="'?$" finder="" filter="" cmdLen=""
# build command and options # build command and options
for c in "$@"; do for c in "$@"; do
@@ -19,11 +19,15 @@ alias-finder() {
zstyle -t ':omz:plugins:alias-finder' cheaper && cheaper=true zstyle -t ':omz:plugins:alias-finder' cheaper && cheaper=true
# format cmd for grep # format cmd for grep
## - replace newlines with spaces ## - replace newlines and multiple spaces with one space
## - trim both ends ## - trim both ends
## - replace multiple spaces with one space
## - add escaping character to special characters ## - 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 if [[ $longer == true ]]; then
wordEnd="" # remove wordEnd to find longer aliases wordEnd="" # remove wordEnd to find longer aliases
@@ -35,7 +39,7 @@ alias-finder() {
# make filter to find only shorter results than current cmd # make filter to find only shorter results than current cmd
if [[ $cheaper == true ]]; then if [[ $cheaper == true ]]; then
cmdLen=$(echo -n "$cmd" | wc -c) cmdLen=${#cmd}
if [[ $cmdLen -le 1 ]]; then if [[ $cmdLen -le 1 ]]; then
return return
fi fi
+2 -2
View File
@@ -13,6 +13,6 @@ fi
# Generate and load arduino-cli completion # Generate and load arduino-cli completion
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_arduino-cli" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._arduino-cli"
zf_mv -f -- =( arduino-cli completion zsh ) "$TMPPREFIX" zf_mv -f -- =( arduino-cli completion zsh ) "$ZSH_CACHE_DIR/completions/_arduino-cli"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_argocd" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._argocd"
zf_mv -f -- =( argocd completion zsh ) "$TMPPREFIX" zf_mv -f -- =( argocd completion zsh ) "$ZSH_CACHE_DIR/completions/_argocd"
} &| } &|
+2 -2
View File
@@ -14,6 +14,6 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
fi fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_asdf" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._asdf"
zf_mv -f -- =( asdf completion zsh ) "$TMPPREFIX" zf_mv -f -- =( asdf completion zsh ) "$ZSH_CACHE_DIR/completions/_asdf"
} &| } &|
+5 -5
View File
@@ -25,10 +25,10 @@ if [[ "$OSTYPE" = darwin* ]]; then
echo "$(ioreg -rc AppleSmartBattery | grep -o '"Watts"=[0-9]\+' | head -1 | grep -o '[0-9]\+')W " echo "$(ioreg -rc AppleSmartBattery | grep -o '"Watts"=[0-9]\+' | head -1 | grep -o '[0-9]\+')W "
} }
function battery_is_charging() { function battery_is_charging() {
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes' ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected" = Yes'
} }
function battery_pct() { function battery_pct() {
pmset -g batt | grep -Eo "\d+%" | cut -d% -f1 pmset -g batt | grep -Eo "[0-9]+%" | cut -d% -f1
} }
function battery_pct_remaining() { function battery_pct_remaining() {
if battery_is_charging; then if battery_is_charging; then
@@ -39,8 +39,8 @@ if [[ "$OSTYPE" = darwin* ]]; then
} }
function battery_time_remaining() { function battery_time_remaining() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected" = No') -eq 1 ]]; then
timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //') timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty" = ' | sed -e 's/^.*"AvgTimeToEmpty" = //')
if [ $timeremaining -gt 720 ]; then if [ $timeremaining -gt 720 ]; then
echo "::" echo "::"
else else
@@ -52,7 +52,7 @@ if [[ "$OSTYPE" = darwin* ]]; then
} }
function battery_pct_prompt () { function battery_pct_prompt () {
local battery_pct color local battery_pct color
if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected" = No'; then
battery_pct=$(battery_pct_remaining) battery_pct=$(battery_pct_remaining)
if [[ $battery_pct -gt 50 ]]; then if [[ $battery_pct -gt 50 ]]; then
color='green' color='green'
+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
}
+25 -15
View File
@@ -1,6 +1,6 @@
# Bridgetown plugin # Bridgetown plugin
This plugin adds some aliases and autocompletion for common [Bridgetown](https://bridgetownrb.com/) commands. This plugin adds aliases for common [Bridgetown](https://www.bridgetownrb.com/) commands.
To use it, add `bridgetown` to the plugins array in your zshrc file: To use it, add `bridgetown` to the plugins array in your zshrc file:
@@ -10,17 +10,27 @@ plugins=(... bridgetown)
## Aliases ## Aliases
| Alias | Command | Most aliases use the project's `bin/bridgetown` executable so the command runs with the Bridgetown version
|-------|----------------------------| locked in its `Gemfile`. The `br` and `brn` aliases use the globally installed executable and can be run
| br | `bridgetown` | outside a Bridgetown project.
| bra | `bin/bridgetown apply` |
| brb | `bin/bridgetown build` | | Alias | Command | Description |
| brc | `bin/bridgetown console` | | --------- | ---------------------------- | ---------------------------------------- |
| brclean | `bin/bridgetown clean` | | `br` | `bridgetown` | Run the globally installed CLI |
| brd | `bin/bridgetown deploy` | | `bra` | `bin/bridgetown apply` | Apply an automation |
| brdoc | `bin/bridgetown doctor` | | `brb` | `bin/bridgetown build` | Build the site |
| brh | `bin/bridgetown help` | | `brc` | `bin/bridgetown console` | Open the Bridgetown console |
| brn | `bridgetown new` | | `brclean` | `bin/bridgetown clean` | Remove generated files and caches |
| brp | `bridgetown plugins` | | `brco` | `bin/bridgetown configure` | Apply a bundled configuration |
| brpl | `bridgetown plugins list` | | `brd` | `bin/bridgetown deploy` | Run the project's deployment task |
| brs | `bin/bridgetown start` | | `brdev` | `bin/bridgetown dev` | Start the development server |
| `bre` | `bin/bridgetown esbuild` | Manage the esbuild configuration |
| `brh` | `bin/bridgetown help` | Show command help |
| `brn` | `bridgetown new` | Create a new Bridgetown site |
| `brp` | `bin/bridgetown plugins` | Access plugin commands |
| `brpl` | `bin/bridgetown plugins list` | List installed plugins |
| `brs` | `bin/bridgetown start` | Start the development server |
| `brt` | `bin/bridgetown test` | Run the project's test build task |
`deploy` and `test` are standard tasks from the `Rakefile` generated for a new Bridgetown site. If the project
customizes or removes those tasks, the corresponding aliases follow that project behavior.
+6 -3
View File
@@ -3,10 +3,13 @@ alias bra='bin/bridgetown apply'
alias brb='bin/bridgetown build' alias brb='bin/bridgetown build'
alias brc='bin/bridgetown console' alias brc='bin/bridgetown console'
alias brclean='bin/bridgetown clean' alias brclean='bin/bridgetown clean'
alias brco='bin/bridgetown configure'
alias brd='bin/bridgetown deploy' alias brd='bin/bridgetown deploy'
alias brdoc='bin/bridgetown doctor' alias brdev='bin/bridgetown dev'
alias bre='bin/bridgetown esbuild'
alias brh='bin/bridgetown help' alias brh='bin/bridgetown help'
alias brn='bridgetown new' alias brn='bridgetown new'
alias brp='bridgetown plugins' alias brp='bin/bridgetown plugins'
alias brpl='bridgetown plugins list' alias brpl='bin/bridgetown plugins list'
alias brs='bin/bridgetown start' alias brs='bin/bridgetown start'
alias brt='bin/bridgetown test'
+2 -2
View File
@@ -13,6 +13,6 @@ fi
# Generate and load buf completion # Generate and load buf completion
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_buf" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._buf"
zf_mv -f -- =( buf completion zsh ) "$TMPPREFIX" zf_mv -f -- =( buf completion zsh ) "$ZSH_CACHE_DIR/completions/_buf"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_bun" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._bun"
zf_mv -f -- =( SHELL=zsh bun completions ) "$TMPPREFIX" zf_mv -f -- =( SHELL=zsh bun completions ) "$ZSH_CACHE_DIR/completions/_bun"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_charm" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._charm"
zf_mv -f -- =( charm completion zsh ) "$TMPPREFIX" zf_mv -f -- =( charm completion zsh ) "$ZSH_CACHE_DIR/completions/_charm"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_chezmoi" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._chezmoi"
zf_mv -f -- =( chezmoi completion zsh ) "$TMPPREFIX" zf_mv -f -- =( chezmoi completion zsh ) "$ZSH_CACHE_DIR/completions/_chezmoi"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_codex" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._codex"
zf_mv -f -- =( codex completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX" zf_mv -f -- =( codex completion zsh < /dev/null 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_codex"
} &| } &|
+1 -1
View File
@@ -14,6 +14,6 @@ function copyfile {
return 1 return 1
fi fi
clipcopy $1 clipcopy $1 || return 1
echo ${(%):-"%B$1%b copied to clipboard."} echo ${(%):-"%B$1%b copied to clipboard."}
} }
+74
View File
@@ -0,0 +1,74 @@
#!/usr/bin/env zsh
emulate -LR zsh
source "${1:-${0:A:h:h}/copyfile.plugin.zsh}"
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
typeset -i clipboard_status=0 failures=0 tests=0
typeset output expected_output
clipcopy() {
print -r -- "$#" "$1" >| "$test_dir/call"
if (( clipboard_status )); then
print -u2 -r -- "clipboard backend failed"
return $clipboard_status
fi
command cat -- "$1" >| "$test_dir/clipboard"
}
check_copyfile() {
local description="$1" expected_status="$2" expected_stdout="$3" expected_stderr="$4"
shift 4
output=$(copyfile "$@" 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
}
for filename in plain.txt 'file with spaces.txt' 'unicode-ą.txt' empty.txt; do
if [[ $filename == empty.txt ]]; then
: >| "$test_dir/$filename"
else
print -r -- "contents of $filename" >| "$test_dir/$filename"
fi
expected_output=${(%):-"%B$test_dir/$filename%b copied to clipboard."}
clipboard_status=0
check_copyfile "successful copy of $filename" 0 "$expected_output" '' "$test_dir/$filename"
if [[ $(<"$test_dir/call") != "1 $test_dir/$filename" ]] || ! command cmp -s -- "$test_dir/$filename" "$test_dir/clipboard"; then
print -u2 -r -- "FAIL: clipboard received a different argument or contents for $filename"
(( failures++ ))
fi
for clipboard_status in 1 42 127; do
check_copyfile "clipboard exit $clipboard_status for $filename" 1 '' 'clipboard backend failed' "$test_dir/$filename"
done
done
command rm -f -- "$test_dir/call"
check_copyfile 'missing argument' 1 'Usage: copyfile <file>' ''
check_copyfile 'empty argument' 1 'Usage: copyfile <file>' '' ''
check_copyfile 'nonexistent file' 1 "Error: '$test_dir/missing.txt' is not a valid file." '' "$test_dir/missing.txt"
check_copyfile 'directory argument' 1 "Error: '$test_dir' is not a valid file." '' "$test_dir"
if [[ -e "$test_dir/call" ]]; then
print -u2 -r -- 'FAIL: invalid input invoked the clipboard backend'
(( failures++ ))
fi
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
+2 -2
View File
@@ -27,6 +27,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_deno" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._deno"
zf_mv -f -- =( deno completions zsh ) "$TMPPREFIX" zf_mv -f -- =( deno completions zsh ) "$ZSH_CACHE_DIR/completions/_deno"
} &| } &|
+1 -1
View File
@@ -52,7 +52,7 @@ function push_future() {
if [[ $#dirhistory_future -ge $DIRHISTORY_SIZE ]]; then if [[ $#dirhistory_future -ge $DIRHISTORY_SIZE ]]; then
shift dirhistory_future shift dirhistory_future
fi 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) dirhistory_future+=($1)
fi fi
} }
+29 -25
View File
@@ -13,28 +13,32 @@ plugins=(... docker-compose)
## Aliases ## Aliases
| Alias | Command | Description | | Alias | Command | Description |
|-----------|----------------------------------|----------------------------------------------------------------------------------| |-----------|-------------------------------------|----------------------------------------------------------------------------------------------|
| dco | `docker-compose` | Docker-compose main command | | dco | `docker-compose` | Docker-compose main command |
| dcb | `docker-compose build` | Build containers | | dcb | `docker-compose build` | Build containers |
| dcc | `docker-compose config` | Parse, resolve and render compose file in canonical format | | dcc | `docker-compose config` | Parse, resolve and render compose file in canonical format |
| dce | `docker-compose exec` | Execute command inside a container | | dce | `docker-compose exec` | Execute command inside a container |
| dcps | `docker-compose ps` | List containers | | dcps | `docker-compose ps` | List containers |
| dcrestart | `docker-compose restart` | Restart container | | dcrestart | `docker-compose restart` | Restart container |
| dcrm | `docker-compose rm` | Remove container | | dcrm | `docker-compose rm` | Remove container |
| dcr | `docker-compose run` | Run a command in container | | dcr | `docker-compose run` | Run a command in container |
| dcstop | `docker-compose stop` | Stop a container | | dcstop | `docker-compose stop` | Stop a container |
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service | | dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers | | dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon | | dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon | | dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
| dcdn | `docker-compose down` | Stop and remove containers | | dcupw | `docker-compose up --watch` | Watch changes in service and rebuild/restart accordingly (see [Use Compose Watch] for usage) |
| dcl | `docker-compose logs` | Show logs of container | | dcupwb | `docker-compose up --watch --build` | Same as `dcupw`, but build images before starting containers |
| dclf | `docker-compose logs -f` | Show logs and follow output | | dcdn | `docker-compose down` | Stop and remove containers |
| dclF | `docker-compose logs -f --tail0` | Just follow recent logs | | dcl | `docker-compose logs` | Show logs of container |
| dcpull | `docker-compose pull` | Pull image of a service | | dclf | `docker-compose logs -f` | Show logs and follow output |
| dcstart | `docker-compose start` | Start a container | | dclF | `docker-compose logs -f --tail0` | Just follow recent logs |
| dck | `docker-compose kill` | Kills containers | | dcpull | `docker-compose pull` | Pull image of a service |
| dcv | `docker-compose version` | Show version information | | dcstart | `docker-compose start` | Start a container |
| dcsts | `docker-compose stats` | Show stats of containers | | dck | `docker-compose kill` | Kills containers |
| dci | `docker-compose images` | List images | | dcv | `docker-compose version` | Show version information |
| dcsts | `docker-compose stats` | Show stats of containers |
| dci | `docker-compose images` | List images |
[Use Compose Watch]: https://docs.docker.com/compose/how-tos/file-watch/
@@ -17,6 +17,8 @@ alias dcup="$dccmd up"
alias dcupb="$dccmd up --build" alias dcupb="$dccmd up --build"
alias dcupd="$dccmd up -d" alias dcupd="$dccmd up -d"
alias dcupdb="$dccmd up -d --build" alias dcupdb="$dccmd up -d --build"
alias dcupw="$dccmd up --watch"
alias dcupwb="$dccmd up --watch --build"
alias dcdn="$dccmd down" alias dcdn="$dccmd down"
alias dcl="$dccmd logs" alias dcl="$dccmd logs"
alias dclf="$dccmd logs -f" alias dclf="$dccmd logs -f"
+7 -2
View File
@@ -48,6 +48,11 @@ fi
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}" 0="${${(M)0:#/*}:-$PWD/$0}"
# Make sure the cache directory exists; when the plugin is loaded by a
# standalone plugin manager (e.g. antigen) the core is not sourced, so
# $ZSH_CACHE_DIR/completions may not have been created yet (#13679).
[[ -d "$ZSH_CACHE_DIR/completions" ]] || mkdir -p "$ZSH_CACHE_DIR/completions"
# If the completion file doesn't exist yet, we need to autoload it and # If the completion file doesn't exist yet, we need to autoload it and
# bind it to `docker`. Otherwise, compinit will have already done that. # bind it to `docker`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
@@ -68,7 +73,7 @@ zmodload -F zsh/files b:zf_mv
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then ! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
command cp "${plugin_dir}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker" command cp "${plugin_dir}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
else else
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_docker" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._docker"
zf_mv -f -- =( command docker completion zsh ) "$TMPPREFIX" zf_mv -f -- =( command docker completion zsh ) "$ZSH_CACHE_DIR/completions/_docker"
fi fi
} "${0:A:h}" &| } "${0:A:h}" &|
+2 -2
View File
@@ -16,6 +16,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_doctl" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._doctl"
zf_mv -f -- =( doctl completion zsh ) "$TMPPREFIX" zf_mv -f -- =( doctl completion zsh ) "$ZSH_CACHE_DIR/completions/_doctl"
} &| } &|
+1 -1
View File
@@ -100,7 +100,7 @@ takes preference, _i.e._ the .env file will never be sourced.
## Named Pipe (FIFO) Support ## Named Pipe (FIFO) Support
The plugin supports `.env` files provided as UNIX named pipes (FIFOs) in addition to regular files. 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. 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. 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 | | `drcr` | `drush core-cron` | Run all cron hooks in all active modules for specified site |
| `drct` | `drush cc theme-registry` | Clear theme-registry cache | | `drct` | `drush cc theme-registry` | Clear theme-registry cache |
| `drcv` | `drush cc views` | Clear views cache _(make sure that the views module is enabled)_ | | `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 | | `drf` | `drush features` | Display features status |
| `drfr` | `drush features-revert -y` | Revert a feature module on your site | | `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 | | `drfra` | `drush features-revert-all` | Revert all enabled feature module on your site |
+3 -1
View File
@@ -35,7 +35,9 @@ alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
alias eframe='emacsclient --alternate-editor="" --create-frame' alias eframe='emacsclient --alternate-editor="" --create-frame'
# Emacs ANSI Term tracking # Emacs ANSI Term tracking
if [[ -n "$INSIDE_EMACS" ]] && [[ "$INSIDE_EMACS" != "vterm" ]]; then local excluded_terms=(vterm ghostel)
local current_term="${INSIDE_EMACS%%,*}"
if [[ -n "$INSIDE_EMACS" ]] && (( ! ${excluded_terms[(Ie)$current_term]} )); then
chpwd_emacs() { print -P "\033AnSiTc %d"; } chpwd_emacs() { print -P "\033AnSiTc %d"; }
print -P "\033AnSiTc %d" # Track current working directory print -P "\033AnSiTc %d" # Track current working directory
print -P "\033AnSiTu %n" # Track username print -P "\033AnSiTu %n" # Track username
+3 -2
View File
@@ -32,8 +32,9 @@ emacsfun() {
# Check if there are suitable frames # Check if there are suitable frames
frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null |sed 's/.*\x07//g' )" frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null |sed 's/.*\x07//g' )"
# Only create another X frame if there isn't one present # A bare emacs/e passes only --no-wait, so it still needs --create-frame.
if [ -z "$frames" -o "$frames" = nil ]; then if [ -z "$frames" ] || [ "$frames" = nil ] || [ "$#" -eq 0 ] \
|| { [ "$#" -eq 1 ] && [ "$1" = --no-wait ]; }; then
emacsclient --alternate-editor="" --create-frame "$@" emacsclient --alternate-editor="" --create-frame "$@"
return $? return $?
fi fi
+1 -1
View File
@@ -40,7 +40,7 @@ case $state in
'new' \ 'new' \
'serve' \ 'serve' \
'test' \ 'test' \
'vesion' && ret=0 'version' && ret=0
;; ;;
addon) addon)
_arguments \ _arguments \
+3 -3
View File
@@ -46,10 +46,10 @@ Encode a file's contents to base64 and save output to text file.
- From parameter - From parameter
```console ```console
$ encodefile64 ohmyzsh.icn $ encodefile64 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
$ ef64 "oh-my-zsh" $ 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 ### Decoding
+21 -8
View File
@@ -2,24 +2,37 @@ encode64() {
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
cat | base64 cat | base64
else else
printf '%s' $1 | base64 printf '%s' "$1" | base64
fi fi
} }
encodefile64() { encodefile64() {
if [[ $# -eq 0 ]]; then if [[ $# -ne 1 || ! -f "$1" || ! -r "$1" ]]; then
echo "You must provide a filename" print -u2 -- 'Usage: encodefile64 <file>'
else return 1
base64 $1 > $1.txt
echo "${1}'s content encoded in base64 and saved as ${1}.txt"
fi 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() { decode64() {
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
cat | base64 --decode cat | base64 -d
else else
printf '%s' $1 | base64 --decode printf '%s' "$1" | base64 -d
fi fi
} }
alias e64=encode64 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 ))
+16 -4
View File
@@ -101,12 +101,14 @@ EOF
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;; (*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;; (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;; (*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
(*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;; (*.bz2)
(( $+commands[pbzip2] )) && pbzip2 -cd "$full_path" > "${file:t:r}" \
|| bunzip2 -c "$full_path" > "${file:t:r}" ;;
(*.xz) xzcat "$full_path" > "${file:t:r}" ;; (*.xz) xzcat "$full_path" > "${file:t:r}" ;;
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;; (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
(*.lz4) lz4 -d "$full_path" ;; (*.lz4) lz4 -d "$full_path" ;;
(*.lzma) unlzma "$full_path" ;; (*.lzma) unlzma -c "$full_path" > "${file:t:r}" ;;
(*.z) uncompress "$full_path" ;; (*.z) uncompress -c "$full_path" > "${file:t:r}" ;;
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;; (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
(*.rar) (*.rar)
if (( $+commands[unrar] )); then if (( $+commands[unrar] )); then
@@ -119,7 +121,17 @@ EOF
fi ;; fi ;;
(*.rpm) (*.rpm)
rpm2cpio "$full_path" | cpio --quiet -id ;; rpm2cpio "$full_path" | cpio --quiet -id ;;
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;; (*.7z | *.7z.[0-9]* | *.pk7)
if (( $+commands[7zz] )); then
7zz x "$full_path"
elif (( $+commands[7z] )); then
7z x "$full_path"
elif (( $+commands[7za] )); then
7za x "$full_path"
else
echo "extract: cannot extract 7z files: install 7zz, 7z or 7za" >&2
success=1
fi ;;
(*.deb) (*.deb)
command mkdir -p "control" "data" command mkdir -p "control" "data"
ar vx "$full_path" > /dev/null ar vx "$full_path" > /dev/null
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env zsh
# Run with: zsh -df plugins/extract/tests/extract.test.zsh
emulate -L zsh
setopt err_return
for tool in lzma unlzma uncompress; do
(( $+commands[$tool] )) || {
print -u2 -r -- "These tests require $tool."
exit 1
}
done
source "${0:A:h:h}/extract.plugin.zsh"
local test_dir=$(mktemp -d) original_dir=$PWD
check_extract() {
local extension=$1 mode=$2
local case_dir="$test_dir/$extension-$mode"
mkdir -p "$case_dir/source files" "$case_dir/work/target dir"
local archive="$case_dir/source files/sample.txt.$extension"
cp "$test_dir/fixture.$extension" "$archive"
builtin cd "$case_dir/work"
local output="$PWD/sample.txt"
local -a args
case "$mode" in
target)
args=(-t 'target dir')
output="$PWD/target dir/sample.txt"
;;
remove) args=(-r) ;;
esac
# Run the plugin without the test's ERR_RETURN option.
() {
emulate -L zsh
extract "${args[@]}" "$archive"
} || return 1
cmp "$test_dir/plain" "$output"
if [[ $mode == remove ]]; then
[[ ! -e $archive ]]
else
[[ -f $archive ]]
fi
print -r -- "PASS: $extension ($mode)"
}
{
print -r -- hello > "$test_dir/plain"
lzma -c "$test_dir/plain" > "$test_dir/fixture.lzma"
# "hello\n" as a .Z stream, since many systems only ship uncompress.
printf '\037\235\220\150\312\260\141\363\106\001' \
> "$test_dir/fixture.Z"
for extension in lzma Z; do
for mode in default target remove; do
check_extract "$extension" "$mode"
done
done
print 'All extract compressed-file tests passed.'
} always {
builtin cd "$original_dir"
rm -rf -- "$test_dir"
}
+2 -2
View File
@@ -32,6 +32,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_flutter" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._flutter"
zf_mv -f -- =( flutter zsh-completion < /dev/null ) "$TMPPREFIX" zf_mv -f -- =( flutter zsh-completion < /dev/null ) "$ZSH_CACHE_DIR/completions/_flutter"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_flux" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._flux"
zf_mv -f -- =( flux completion zsh ) "$TMPPREFIX" zf_mv -f -- =( flux completion zsh ) "$ZSH_CACHE_DIR/completions/_flux"
} &| } &|
+2 -2
View File
@@ -12,8 +12,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_fnm" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._fnm"
zf_mv -f -- =( fnm completions --shell=zsh ) "$TMPPREFIX" zf_mv -f -- =( fnm completions --shell=zsh ) "$ZSH_CACHE_DIR/completions/_fnm"
} &| } &|
if zstyle -t ':omz:plugins:fnm' autostart; then if zstyle -t ':omz:plugins:fnm' autostart; then
+1
View File
@@ -7,6 +7,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
search_locations=( search_locations=(
"$HOME/google-cloud-sdk" "$HOME/google-cloud-sdk"
"/usr/local/share/google-cloud-sdk" "/usr/local/share/google-cloud-sdk"
"/usr/local/google-cloud-sdk"
"/usr/local/Caskroom/google-cloud-sdk/latest/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/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/opt/homebrew/share/google-cloud-sdk" "/opt/homebrew/share/google-cloud-sdk"
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_gcx" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._gcx"
zf_mv -f -- =( gcx completion zsh ) "$TMPPREFIX" zf_mv -f -- =( gcx completion zsh ) "$ZSH_CACHE_DIR/completions/_gcx"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_gh" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._gh"
zf_mv -f -- =( gh completion --shell zsh ) "$TMPPREFIX" zf_mv -f -- =( gh completion --shell zsh ) "$ZSH_CACHE_DIR/completions/_gh"
} &| } &|
+5 -8
View File
@@ -1,7 +1,6 @@
# git-commit plugin # git-commit plugin
The git-commit plugin adds several The git-commit plugin adds several git subcommands for
[git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for
[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages. [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
To use it, add `git-commit` to the plugins array in your zshrc file: To use it, add `git-commit` to the plugins array in your zshrc file:
@@ -31,15 +30,13 @@ Where `type` is one of the following:
- `test` - `test`
- `wip` - `wip`
> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name. > NOTE: the subcommand for `revert` type is `rev`, as otherwise it conflicts with the
> It will still generate a commit message in the format `revert: <message>` > git command of the same name. It will still generate a commit message in the format
> `revert: <message>`
> ⚠️ Enabling this plugin will (potentially) overwrite all `alias.<type>` that you manually set. Use with
> care!
## Examples ## Examples
| Git alias | Command | | Git subcommand | Command |
| --------------------------------------------- | ---------------------------------------------------- | | --------------------------------------------- | ---------------------------------------------------- |
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` | | `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 "work in progress"` |
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+1
View File
@@ -0,0 +1 @@
./omz_git_commit
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env zsh
_omz_git_commit() {
0=${(%):-%x}
if [[ "$0" != */git-* ]]; then
echo >&2 "Expecting command named git-foo. Got '$0'."
return 1
fi
local _type="${0##*/git-}"
# The subcommand is shortened to avoid Git's built-in revert command.
if [[ "$_type" == rev ]]; then
_type=revert
fi
local _scope _attention _message
while [ $# -ne 0 ]; do
case $1 in
-s | --scope )
if [ -z $2 ]; then
echo >&2 "Missing scope!"
return 1
fi
_scope="$2"
shift 2
;;
-a | --attention )
_attention="!"
shift 1
;;
* )
_message="${_message} $1"
shift 1
;;
esac
done
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}"
}
_omz_git_commit "$@"
+42 -55
View File
@@ -1,58 +1,45 @@
local _rev="$(git -C $ZSH rev-parse HEAD 2> /dev/null)" # Add git-commit commands directory to path
if [[ $_rev == $(git config --global --get oh-my-zsh.git-commit-alias 2> /dev/null) ]]; then 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
return 0="${${(M)0:#/*}:-$PWD/$0}"
fi path=("${0:a:h}/git-commands" $path)
git config --global oh-my-zsh.git-commit-alias "$_rev"
local -a _git_commit_aliases # Append completions for custom git commands
_git_commit_aliases=( () {
'build' local -a git_user_commands
'chore' zstyle -a ':completion:*:*:git:*' user-commands 'git_user_commands' \
'ci' || git_user_commands=()
'docs' git_user_commands+=(
'feat' build:'Commit with a message indicating a build' \
'fix' chore:'Commit with a message indicating a chore' \
'perf' ci:'Commit with a message indicating a CI change' \
'refactor' docs:'Commit with a message indicating an update to the documentation' \
'revert' feat:'Commit with a message indicating a feature' \
'style' fix:'Commit with a message indicating a fix' \
'test' perf:'Commit with a message indicating a performance enhancement' \
'wip' refactor:'Commit with a message indicating a refactor' \
) rev:'Commit with a message indicating a revert' \
style:'Commit with a message indicating a style change' \
test:'Commit with a message indicating updates to tests' \
wip:'Commit with a message indicating a work in progress'
)
zstyle ':completion:*:*:git:*' user-commands "${git_user_commands[@]}"
}
local _alias _type # Clean up aliases from the prior implementation of git-commit. Keep this migration
for _type in "${_git_commit_aliases[@]}"; do # for users upgrading from versions that still wrote aliases to .gitconfig.
# an alias can't be named "revert" because the git command takes precedence () {
# https://stackoverflow.com/a/3538791 git config --global --get oh-my-zsh.git-commit-alias &> /dev/null || return 0
case "$_type" in local -a old_git_aliases=(
revert) _alias=rev ;; 'build' 'chore' 'ci'
*) _alias=$_type ;; 'docs' 'feat' 'fix'
esac 'perf' 'refactor' 'rev'
'style' 'test' 'wip'
local _func='!a() { )
local _scope _attention _message local git_alias
while [ $# -ne 0 ]; do for git_alias in $old_git_aliases; do
case $1 in if [[ "$(git config --global --get alias.$git_alias | tr '\n' ' ')" == "!a() { local _scope _attention _message"* ]]; then
-s | --scope ) git config --global --unset alias.$git_alias
if [ -z $2 ]; then
echo "Missing scope!"
return 1
fi fi
_scope="$2" done
shift 2 git config --global --unset oh-my-zsh.git-commit-alias
;; }
-a | --attention )
_attention="!"
shift 1
;;
* )
_message="${_message} $1"
shift 1
;;
esac
done
git commit -m "'$_type'${_scope:+(${_scope})}${_attention}:${_message}"
}; a'
git config --global alias.$_alias "$_func"
done
+6
View File
@@ -108,6 +108,7 @@ plugins=(... git)
| `glo` | `git log --oneline --decorate` | | `glo` | `git log --oneline --decorate` |
| `glog` | `git log --oneline --decorate --graph` | | `glog` | `git log --oneline --decorate --graph` |
| `gloga` | `git log --oneline --decorate --graph --all` | | `gloga` | `git log --oneline --decorate --graph --all` |
| `glom` | `git log --oneline --decorate --color $(git_main_branch)..` |
| `glp` | `git log --pretty=<format>` | | `glp` | `git log --pretty=<format>` |
| `glg` | `git log --stat` | | `glg` | `git log --stat` |
| `glgp` | `git log --stat --patch` | | `glgp` | `git log --stat --patch` |
@@ -155,6 +156,8 @@ plugins=(... git)
| `grba` | `git rebase --abort` | | `grba` | `git rebase --abort` |
| `grbc` | `git rebase --continue` | | `grbc` | `git rebase --continue` |
| `grbi` | `git rebase --interactive` | | `grbi` | `git rebase --interactive` |
| `grbmi` | `git rebase $(git_main_branch) --interactive` |
| `grbmia` | `git rebase $(git_main_branch) --interactive --autosquash` |
| `grbo` | `git rebase --onto` | | `grbo` | `git rebase --onto` |
| `grbs` | `git rebase --skip` | | `grbs` | `git rebase --skip` |
| `grbd` | `git rebase $(git_develop_branch)` | | `grbd` | `git rebase $(git_develop_branch)` |
@@ -188,6 +191,7 @@ plugins=(... git)
| `grmc` | `git rm --cached` | | `grmc` | `git rm --cached` |
| `gcount` | `git shortlog --summary -n` | | `gcount` | `git shortlog --summary -n` |
| `gsh` | `git show` | | `gsh` | `git show` |
| `gshs` | `git show --stat` |
| `gsps` | `git show --pretty=short --show-signature` | | `gsps` | `git show --pretty=short --show-signature` |
| `gstall` | `git stash --all` | | `gstall` | `git stash --all` |
| `gstu` | `git stash --include-untracked` | | `gstu` | `git stash --include-untracked` |
@@ -202,8 +206,10 @@ plugins=(... git)
| `gst` | `git status` | | `gst` | `git status` |
| `gss` | `git status --short` | | `gss` | `git status --short` |
| `gsb` | `git status --short -b` | | `gsb` | `git status --short -b` |
| `gsnut` | `git status --untracked-files=no` |
| `gsi` | `git submodule init` | | `gsi` | `git submodule init` |
| `gsu` | `git submodule update` | | `gsu` | `git submodule update` |
| `gsuri` | `git submodule update --recursive --init` |
| `gsd` | `git svn dcommit` | | `gsd` | `git svn dcommit` |
| `git-svn-dcommit-push` | `git svn dcommit && git push github $(git_main_branch):svntrunk` | | `git-svn-dcommit-push` | `git svn dcommit && git push github $(git_main_branch):svntrunk` |
| `gsr` | `git svn rebase` | | `gsr` | `git svn rebase` |
+6
View File
@@ -253,6 +253,7 @@ alias glolm='git log $(git_main_branch) --graph --pretty="%Cred%h%Creset -%C(aut
alias glo='git log --oneline --decorate' alias glo='git log --oneline --decorate'
alias glog='git log --oneline --decorate --graph' alias glog='git log --oneline --decorate --graph'
alias gloga='git log --oneline --decorate --graph --all' alias gloga='git log --oneline --decorate --graph --all'
alias glom='git log --oneline --decorate --color $(git_main_branch)..'
# Pretty log messages # Pretty log messages
function _git_log_prettily(){ function _git_log_prettily(){
@@ -362,6 +363,8 @@ alias grbd='git rebase $(git_develop_branch)'
alias grbm='git rebase $(git_main_branch)' alias grbm='git rebase $(git_main_branch)'
alias grbom='git rebase origin/$(git_main_branch)' alias grbom='git rebase origin/$(git_main_branch)'
alias grbum='git rebase upstream/$(git_main_branch)' alias grbum='git rebase upstream/$(git_main_branch)'
alias grbmi='git rebase $(git_main_branch) --interactive'
alias grbmia='git rebase $(git_main_branch) --interactive --autosquash'
alias grf='git reflog' alias grf='git reflog'
alias gr='git remote' alias gr='git remote'
alias grv='git remote --verbose' alias grv='git remote --verbose'
@@ -389,6 +392,7 @@ alias grm='git rm'
alias grmc='git rm --cached' alias grmc='git rm --cached'
alias gcount='git shortlog --summary --numbered' alias gcount='git shortlog --summary --numbered'
alias gsh='git show' alias gsh='git show'
alias gshs='git show --stat'
alias gsps='git show --pretty=short --show-signature' alias gsps='git show --pretty=short --show-signature'
alias gstall='git stash --all' alias gstall='git stash --all'
alias gstaa='git stash apply' alias gstaa='git stash apply'
@@ -404,8 +408,10 @@ alias gsts='git stash show --patch'
alias gst='git status' alias gst='git status'
alias gss='git status --short' alias gss='git status --short'
alias gsb='git status --short --branch' alias gsb='git status --short --branch'
alias gsnut='git status --untracked-files=no'
alias gsi='git submodule init' alias gsi='git submodule init'
alias gsu='git submodule update' alias gsu='git submodule update'
alias gsuri='git submodule update --recursive --init'
alias gsd='git svn dcommit' alias gsd='git svn dcommit'
alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk' alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
alias gsr='git svn rebase' alias gsr='git svn rebase'
+34 -36
View File
@@ -1,45 +1,43 @@
# github plugin # github plugin
This plugin supports working with GitHub from the command line. It provides a few things: > [!WARNING]
> This plugin is deprecated and will be removed in a future release. It supports
> the legacy [`hub`](https://github.com/mislav/hub) CLI, not the current GitHub
> CLI. For `gh` completion, use the [`gh` plugin](../gh) instead.
* Sets up the `hub` wrapper and completions for the `git` command if you have [`hub`](https://github.com/github/hub) installed. The plugin provides compatibility for existing `hub` users by:
* Completion for the [`github` Ruby gem](https://github.com/defunkt/github-gem).
* Convenience functions for working with repos and URLs.
### Functions - aliasing `git` to `hub` when `hub` is installed;
- adding completion for `hub`; and
- defining convenience functions for creating repositories.
* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub ## Migrating to GitHub CLI
* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub
* `exist_gh` - Takes an existing repo and pushes it to GitHub
Install [GitHub CLI](https://cli.github.com/), replace `github` with `gh` in
## Installation your plugin list, and restart your shell:
[Hub](https://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ.
The [`github` Ruby gem](https://github.com/defunkt/github-gem) needs to be installed if you want to use it.
### Configuration
These settings affect `github`'s behavior.
#### Environment variables
* `$GITHUB_USER`
* `$GITHUB_PASSWORD`
#### Git configuration options
* `github.user` - GitHub username for repo operations
See `man hub` for more details.
### Homebrew installation note
If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.
```zsh ```zsh
if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then plugins=(... gh)
FPATH=/usr/local/share/zsh/site-functions:$FPATH
fi
``` ```
The `gh` plugin supplies completion for the installed GitHub CLI. It does not
alias `git`, because `gh` is not a Git wrapper.
The closest replacement for creating a GitHub repository from an existing
local repository is:
```zsh
gh repo create --source=. --push
```
## Deprecated functions
- `empty_gh` - creates a new repository with a `README.md` and pushes it to GitHub
- `new_gh` - initializes an existing directory and pushes it to GitHub
- `exist_gh` - pushes an existing Git repository to GitHub
These functions remain available during the deprecation period and require
`hub`. They will be removed with the plugin.
If you continue using `hub`, see its documentation for authentication and
configuration details.
+10 -7
View File
@@ -1,3 +1,6 @@
print -Pru2 -- '%F{yellow}[oh-my-zsh] The %Bgithub%b plugin is deprecated and will be removed in a future release.'
print -Pru2 -- 'It supports the legacy %Bhub%b CLI. Use the %Bgh%b plugin for GitHub CLI completion.%f'
# Set up hub wrapper for git, if it is available; https://github.com/github/hub # Set up hub wrapper for git, if it is available; https://github.com/github/hub
if (( $+commands[hub] )); then if (( $+commands[hub] )); then
alias git=hub alias git=hub
@@ -26,7 +29,7 @@ empty_gh() { # [NAME_OF_REPO]
# This function will add all non-hidden files to git. # This function will add all non-hidden files to git.
new_gh() { # [DIRECTORY] new_gh() { # [DIRECTORY]
emulate -L zsh emulate -L zsh
local repo="$1" local repo="${1-.}"
cd "$repo" \ cd "$repo" \
|| return || return
@@ -42,7 +45,7 @@ new_gh() { # [DIRECTORY]
|| return || return
hub create \ hub create \
|| return || return
git push -u origin master \ git push -u origin HEAD \
|| return || return
} }
@@ -52,18 +55,19 @@ new_gh() { # [DIRECTORY]
# to your GitHub. # to your GitHub.
exist_gh() { # [DIRECTORY] exist_gh() { # [DIRECTORY]
emulate -L zsh emulate -L zsh
local repo=$1 local repo="${1:-.}"
cd "$repo" cd "$repo" \
|| return
hub create \ hub create \
|| return || return
git push -u origin master git push -u origin HEAD
} }
# git.io "GitHub URL" # git.io "GitHub URL"
# #
# Shorten GitHub url, example: # Shorten GitHub url, example:
# https://github.com/nvogel/dotzsh > https://git.io/8nU25w # https://github.com/nvogel/dotzsh > https://git.io/8nU25w
# source: https://github.com/nvogel/dotzsh # source: https://github.com/nvogel/dotzsh
# documentation: https://github.com/blog/985-git-io-github-url-shortener # documentation: https://github.com/blog/985-git-io-github-url-shortener
# #
@@ -74,4 +78,3 @@ git.io() {
} }
# End Functions ############################################################# # End Functions #############################################################
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_glab" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._glab"
zf_mv -f -- =( glab completion -s zsh ) "$TMPPREFIX" zf_mv -f -- =( glab completion -s zsh ) "$ZSH_CACHE_DIR/completions/_glab"
} &| } &|
+5 -1
View File
@@ -4,7 +4,11 @@ globalias() {
# (A) makes it an array even if there's only one element # (A) makes it an array even if there's only one element
local word=${${(Az)LBUFFER}[-1]} local word=${${(Az)LBUFFER}[-1]}
if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
zle _expand_alias # Completion also considers quoted strings and assignment values as aliases.
# Only expand when the complete shell word is an alias name.
if (( ${+aliases[$word]} || ${+galiases[$word]} )); then
zle _expand_alias
fi
zle expand-word zle expand-word
fi fi
zle self-insert zle self-insert
@@ -0,0 +1,81 @@
#!/usr/bin/env zsh
# Exercise the actual ZLE widgets in an isolated interactive shell.
emulate -L zsh
setopt err_return
zmodload zsh/zpty
zmodload zsh/zselect
local test_dir=$(mktemp -d)
export GLOBALIAS_TEST_PLUGIN=${0:A:h:h}/globalias.plugin.zsh
export GLOBALIAS_TEST_RESULT=$test_dir/result
wait_for_marker() {
local marker=$1 output received
local -i deadline=$(( SECONDS + 5 ))
while (( SECONDS < deadline )); do
if zpty -r globalias-test output; then
received+=$output
[[ $received == *$marker* ]] && return 0
else
zselect -t 1 || true
fi
done
print -u2 -r -- "Timed out waiting for ZLE: $received"
return 1
}
check_expansion() {
local input=$1 expected=$2 actual
zpty -w -n globalias-test "$input"$' \x18'
wait_for_marker GLOBALIAS_TEST_CAPTURED
actual=$(< "$GLOBALIAS_TEST_RESULT")
if [[ $actual != "$expected" ]]; then
print -u2 -r -- "Input: ${(qqq)input}"
print -u2 -r -- "Expected: ${(qqq)expected}; got: ${(qqq)actual}"
return 1
fi
}
{
cat > "$test_dir/setup.zsh" <<'SETUP'
autoload -Uz compinit
compinit -D
source "$GLOBALIAS_TEST_PLUGIN"
alias 1='cd -1'
alias ll='ls -l'
alias -g G='| grep'
GLOBALIAS_FILTER_VALUES=(ll)
_globalias_test_capture() {
print -rn -- "$BUFFER" > "$GLOBALIAS_TEST_RESULT"
print -r -- $'\nGLOBALIAS_TEST_CAPTURED'
BUFFER=
zle .accept-line
}
zle -N _globalias_test_capture
bindkey '^X' _globalias_test_capture
PS1='GLOBALIAS_TEST_READY> '
RPROMPT=
SETUP
zpty -b globalias-test zsh -dfi
zpty -w globalias-test "source ${(q)test_dir}/setup.zsh"
wait_for_marker GLOBALIAS_TEST_READY
check_expansion 'DEBUG=1' 'DEBUG=1 '
check_expansion 'DEBUG="1"' 'DEBUG="1" '
check_expansion "DEBUG='1'" "DEBUG='1' "
check_expansion '1' 'cd -1 '
check_expansion '"1"' '"1" '
check_expansion "'1'" "'1' "
check_expansion '\1' '\1 '
check_expansion 'echo G' 'echo | grep '
check_expansion 'DEBUG=1 1' 'DEBUG=1 cd -1 '
check_expansion 'll' 'll '
check_expansion 'echo $((1+2))' 'echo 3 '
check_expansion 'echo {a,b}' 'echo a b '
check_expansion '' ' '
print 'All globalias expansion tests passed.'
} always {
zpty -d globalias-test 2>/dev/null || true
rm -rf -- "$test_dir"
}
+31 -1
View File
@@ -5,10 +5,40 @@ Applies some fixes for some common issues encountered with [GPG's gpg-agent](htt
More specifically, this plugin: More specifically, this plugin:
- Updates the `GPG_TTY` environment variable before each shell execution. - Updates the `GPG_TTY` environment variable before each shell execution.
- Updates the `SSH_AUTH_SOCK` environment variable if `enable-ssh-support` is turned on. - Updates the `SSH_AUTH_SOCK` environment variable if `gpg-agent` is your SSH
agent. By default the plugin checks whether `enable-ssh-support` is turned
on. The [`ssh-support` setting](#settings) lets you say so yourself.
To use it, add `gpg-agent` to the plugins array of your zshrc file: To use it, add `gpg-agent` to the plugins array of your zshrc file:
```zsh ```zsh
plugins=(... gpg-agent) plugins=(... gpg-agent)
``` ```
## Settings
Every time a shell starts, the plugin runs `gpgconf --list-options gpg-agent` to
find out whether `enable-ssh-support` is turned on. That check can be slow. If
you already know the answer, state it with the `ssh-support` style and the
plugin skips the check. Set it in your zshrc, before Oh My Zsh is sourced.
If you don't use `gpg-agent` as your SSH agent:
```zsh
zstyle ':omz:plugins:gpg-agent' ssh-support no
```
The plugin then only sets `GPG_TTY`. It leaves `SSH_AUTH_SOCK` alone, and it
doesn't update the agent's tty before each command, which only SSH support
needs.
If you do use `gpg-agent` as your SSH agent:
```zsh
zstyle ':omz:plugins:gpg-agent' ssh-support yes
```
The plugin then sets `SSH_AUTH_SOCK` without checking. `enable-ssh-support`
still has to be set in your `gpg-agent.conf` for SSH to work.
Leave the style unset to keep the automatic check.
+16 -1
View File
@@ -1,5 +1,16 @@
export GPG_TTY=$TTY export GPG_TTY=$TTY
# The ssh-support style says whether gpg-agent is used as the ssh agent.
# Setting it saves asking gpgconf, which can be slow.
zstyle -t ':omz:plugins:gpg-agent' ssh-support
_gpg_agent_ssh_support=$? # 0 if yes, 1 if no, 2 if not set
# Everything below is only needed for ssh support
if (( _gpg_agent_ssh_support == 1 )); then
unset _gpg_agent_ssh_support
return
fi
# Fix for passphrase prompt on the correct tty # Fix for passphrase prompt on the correct tty
# See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport # See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport
function _gpg-agent_update-tty_preexec { function _gpg-agent_update-tty_preexec {
@@ -9,9 +20,13 @@ autoload -U add-zsh-hook
add-zsh-hook preexec _gpg-agent_update-tty_preexec add-zsh-hook preexec _gpg-agent_update-tty_preexec
# If enable-ssh-support is set, fix ssh agent integration # If enable-ssh-support is set, fix ssh agent integration
if [[ $(gpgconf --list-options gpg-agent 2>/dev/null | awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then if (( _gpg_agent_ssh_support == 0 )) \
|| [[ $(gpgconf --list-options gpg-agent 2>/dev/null \
| awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then
unset SSH_AGENT_PID unset SSH_AGENT_PID
if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi fi
fi fi
unset _gpg_agent_ssh_support
+4
View File
@@ -267,6 +267,7 @@ __gradle_subcommand() {
'-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn)' \ '-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn)' \
'-Dorg.gradle.configuration-cache.read-only=[]' \ '-Dorg.gradle.configuration-cache.read-only=[]' \
'-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]' \ '-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]' \
'-Dorg.gradle.configuration-cache.unsafe.skip-task-logging-listeners-serialization=[]' \
'-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \ '-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
'-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]' \ '-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]' \
'-Dorg.gradle.console.interactive=[]' \ '-Dorg.gradle.console.interactive=[]' \
@@ -296,6 +297,7 @@ __gradle_subcommand() {
'-Dorg.gradle.jvmargs=[]' \ '-Dorg.gradle.jvmargs=[]' \
'-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug)' \ '-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug)' \
'-Dorg.gradle.logging.stacktrace=[]' \ '-Dorg.gradle.logging.stacktrace=[]' \
'-Dorg.gradle.mirror.maven.settings=[]' \
'-Dorg.gradle.native=[]' \ '-Dorg.gradle.native=[]' \
'-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false)' \ '-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false)' \
'-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low)' \ '-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low)' \
@@ -407,6 +409,7 @@ _gradle() {
'-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn):->argument-expected' \ '-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn):->argument-expected' \
'-Dorg.gradle.configuration-cache.read-only=[]:->argument-expected' \ '-Dorg.gradle.configuration-cache.read-only=[]:->argument-expected' \
'-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]:->argument-expected' \ '-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]:->argument-expected' \
'-Dorg.gradle.configuration-cache.unsafe.skip-task-logging-listeners-serialization=[]:->argument-expected' \
'-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]:->argument-expected' \ '-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]:->argument-expected' \
'-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]:->argument-expected' \ '-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]:->argument-expected' \
'-Dorg.gradle.console.interactive=[]:->argument-expected' \ '-Dorg.gradle.console.interactive=[]:->argument-expected' \
@@ -436,6 +439,7 @@ _gradle() {
'-Dorg.gradle.jvmargs=[]:->argument-expected' \ '-Dorg.gradle.jvmargs=[]:->argument-expected' \
'-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug):->argument-expected' \ '-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug):->argument-expected' \
'-Dorg.gradle.logging.stacktrace=[]:->argument-expected' \ '-Dorg.gradle.logging.stacktrace=[]:->argument-expected' \
'-Dorg.gradle.mirror.maven.settings=[]:->argument-expected' \
'-Dorg.gradle.native=[]:->argument-expected' \ '-Dorg.gradle.native=[]:->argument-expected' \
'-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false):->argument-expected' \ '-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false):->argument-expected' \
'-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low):->argument-expected' \ '-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low):->argument-expected' \
+2 -2
View File
@@ -11,7 +11,7 @@ else
source "$ZSH_CACHE_DIR/completions/_hasura" source "$ZSH_CACHE_DIR/completions/_hasura"
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hasura" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._hasura"
zf_mv -f -- =( hasura completion zsh ) "$TMPPREFIX" zf_mv -f -- =( hasura completion zsh ) "$ZSH_CACHE_DIR/completions/_hasura"
} &| } &|
fi fi
+2 -2
View File
@@ -15,8 +15,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hcloud" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._hcloud"
zf_mv -f -- =( hcloud completion zsh 2> /dev/null ) "$TMPPREFIX" zf_mv -f -- =( hcloud completion zsh 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_hcloud"
} &| } &|
# Main alias # Main alias
+2 -2
View File
@@ -11,8 +11,8 @@ else
source "$ZSH_CACHE_DIR/completions/_helm" source "$ZSH_CACHE_DIR/completions/_helm"
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_helm" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._helm"
zf_mv -f -- =( helm completion zsh ) "$TMPPREFIX" zf_mv -f -- =( helm completion zsh ) "$ZSH_CACHE_DIR/completions/_helm"
} &| } &|
fi fi
+2 -2
View File
@@ -63,6 +63,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_herdr" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._herdr"
zf_mv -f -- =( herdr completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX" zf_mv -f -- =( herdr completion zsh < /dev/null 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_herdr"
} &| } &|
+2 -2
View File
@@ -10,6 +10,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hermes" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._hermes"
zf_mv -f -- =( hermes completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX" zf_mv -f -- =( hermes completion zsh < /dev/null 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_hermes"
} &| } &|
+1 -1
View File
@@ -70,7 +70,7 @@ plugins=(... jj)
## Prompt usage ## 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. 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`: It is basically the same as `jj log --no-graph -r @ -T $1`:
+2 -2
View File
@@ -13,8 +13,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_jj" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._jj"
zf_mv -f -- =( COMPLETE=zsh jj ) "$TMPPREFIX" zf_mv -f -- =( COMPLETE=zsh jj ) "$ZSH_CACHE_DIR/completions/_jj"
} &| } &|
function __jj_prompt_jj() { function __jj_prompt_jj() {
+14 -8
View File
@@ -22,14 +22,17 @@ fi
# Define json tools for each method # Define json tools for each method
case "$JSONTOOLS_METHOD" in case "$JSONTOOLS_METHOD" in
node) node)
# node doesn't make it easy to deal with stdin, so we pass it as an argument with xargs -0 # Read stdin directly so input is not limited by command-line argument size.
function pp_json() { function pp_json() {
xargs -0 node -e 'console.log(JSON.stringify(JSON.parse(process.argv[1]), null, 4));' node -e '
const input = require("fs").readFileSync(0, "utf8");
console.log(JSON.stringify(JSON.parse(input), null, 4));
'
} }
function is_json() { function is_json() {
xargs -0 node -e ' node -e '
try { try {
json = JSON.parse(process.argv[1]); JSON.parse(require("fs").readFileSync(0, "utf8"));
console.log("true"); console.log("true");
process.exit(0); process.exit(0);
} catch (e) { } catch (e) {
@@ -39,10 +42,14 @@ case "$JSONTOOLS_METHOD" in
' '
} }
function urlencode_json() { function urlencode_json() {
xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))" node -e '
console.log(encodeURIComponent(require("fs").readFileSync(0, "utf8")));
'
} }
function urldecode_json() { function urldecode_json() {
xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))" node -e '
console.log(decodeURIComponent(require("fs").readFileSync(0, "utf8")));
'
} }
;; ;;
python3) python3)
@@ -79,8 +86,7 @@ print(unquote_plus(sys.stdin.read()))
function pp_json() { function pp_json() {
ruby -e ' ruby -e '
require "json" require "json"
require "yaml" puts JSON.pretty_generate(JSON.parse(STDIN.read), indent: " ")
puts JSON.parse(STDIN.read).to_yaml
' '
} }
function is_json() { 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"
}
@@ -0,0 +1,64 @@
#!/usr/bin/env zsh
# Run with: zsh -df plugins/jsontools/tests/jsontools.test.zsh
emulate -L zsh
setopt err_return
(( $+commands[node] )) || {
print -u2 'These tests require Node.js.'
exit 1
}
JSONTOOLS_METHOD=node
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"
}
{
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'
# Larger than the 128 KiB limit for a single command-line argument.
local large_value=${(l:262144::x:):-}
print -rn -- '{"value":"'"$large_value"'"}' > "$test_dir/input"
printf '{\n "value": "%s"\n}\n' "$large_value" > "$test_dir/expected"
check_output pp_json 'pretty-print a large document'
print -r -- true > "$test_dir/expected"
check_output is_json 'validate a large document'
print -r -- '%7B%22value%22%3A%22'"$large_value"'%22%7D' \
> "$test_dir/expected"
check_output urlencode_json 'encode a large document'
local encoded=$(< "$test_dir/expected")
print -rn -- "$encoded" > "$test_dir/input"
print -r -- '{"value":"'"$large_value"'"}' > "$test_dir/expected"
check_output urldecode_json 'decode a large document'
# Passed as an argument, node used to parse this as its own option.
print -rn -- '--version' > "$test_dir/input"
print -r -- '--version' > "$test_dir/expected"
check_output urlencode_json 'encode input that starts with --'
print -rn -- '{invalid}' > "$test_dir/input"
print -r -- false > "$test_dir/expected"
check_output is_json 'reject invalid JSON' 1
printf '1\0002' > "$test_dir/input"
check_output is_json 'reject input with NUL bytes' 1
print 'All jsontools Node.js tests passed.'
} always {
rm -rf -- "$test_dir"
}
+2 -2
View File
@@ -13,6 +13,6 @@ fi
# the actual completion file will be loaded. # the actual completion file will be loaded.
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_k9s" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._k9s"
zf_mv -f -- =( k9s completion zsh ) "$TMPPREFIX" zf_mv -f -- =( k9s completion zsh ) "$ZSH_CACHE_DIR/completions/_k9s"
} &| } &|
+2 -2
View File
@@ -13,8 +13,8 @@ fi
# Generate and load kind completion # Generate and load kind completion
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_kind" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kind"
zf_mv -f -- =( kind completion zsh ) "$TMPPREFIX" zf_mv -f -- =( kind completion zsh ) "$ZSH_CACHE_DIR/completions/_kind"
} &| } &|
# Register aliases # Register aliases
+39 -12
View File
@@ -39,6 +39,7 @@ KUBE_PS1_HIDE_IF_NOCONTEXT="${KUBE_PS1_HIDE_IF_NOCONTEXT:-false}"
_KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}" _KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
_KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled" _KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
_KUBE_PS1_LAST_TIME=0 _KUBE_PS1_LAST_TIME=0
_KUBE_PS1_HAS_CONTEXT=false
# Determine our shell # Determine our shell
_kube_ps1_shell_type() { _kube_ps1_shell_type() {
@@ -264,15 +265,21 @@ _kube_ps1_prompt_update() {
[[ "${KUBE_PS1_ENABLED}" == "off" ]] && return $return_code [[ "${KUBE_PS1_ENABLED}" == "off" ]] && return $return_code
if ! _kube_ps1_binary_check "${KUBE_PS1_BINARY}"; then if ! _kube_ps1_binary_check "${KUBE_PS1_BINARY}"; then
# No ability to fetch context/namespace; display N/A. # Unable to determine context availability; preserve the existing
# BINARY-N/A prompt instead of treating it as no context.
KUBE_PS1_CONTEXT="BINARY-N/A" KUBE_PS1_CONTEXT="BINARY-N/A"
KUBE_PS1_NAMESPACE="N/A" KUBE_PS1_NAMESPACE="N/A"
unset _KUBE_PS1_HAS_CONTEXT
# Refresh when the binary becomes available again.
_KUBE_PS1_LAST_TIME=0
return $return_code return $return_code
fi fi
if [[ "${KUBECONFIG}" != "${_KUBE_PS1_KUBECONFIG_CACHE}" ]]; then if [[ "${_KUBE_PS1_LAST_TIME}" == 0 ]] ||
# User changed KUBECONFIG; unconditionally refetch. [[ "${KUBECONFIG}" != "${_KUBE_PS1_KUBECONFIG_CACHE}" ]]; then
_KUBE_PS1_KUBECONFIG_CACHE=${KUBECONFIG} # Fetch initially, even if no config file exists, and whenever the
# user changes KUBECONFIG.
_KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
_kube_ps1_get_context_ns _kube_ps1_get_context_ns
return $return_code return $return_code
fi fi
@@ -300,13 +307,30 @@ _kube_ps1_prompt_update() {
} }
_kube_ps1_get_context() { _kube_ps1_get_context() {
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then local context
KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"
KUBE_PS1_CONTEXT="${KUBE_PS1_CONTEXT:-N/A}"
if [[ -n "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then # Context availability must be detected even when context display is
KUBE_PS1_CONTEXT="$("${KUBE_PS1_CLUSTER_FUNCTION}" "${KUBE_PS1_CONTEXT}")" # disabled but KUBE_PS1_HIDE_IF_NOCONTEXT is enabled.
fi if [[ "${KUBE_PS1_CONTEXT_ENABLE}" != true ]] &&
[[ "${KUBE_PS1_HIDE_IF_NOCONTEXT}" != true ]]; then
KUBE_PS1_CONTEXT=
return
fi
context="$("${KUBE_PS1_BINARY}" config current-context 2>/dev/null)"
_KUBE_PS1_HAS_CONTEXT=false
[[ -n "${context}" ]] && _KUBE_PS1_HAS_CONTEXT=true
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" != true ]]; then
KUBE_PS1_CONTEXT=
return
fi
KUBE_PS1_CONTEXT="${context:-N/A}"
if [[ -n "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then
KUBE_PS1_CONTEXT="$("${KUBE_PS1_CLUSTER_FUNCTION}" "${KUBE_PS1_CONTEXT}")"
fi fi
} }
@@ -325,7 +349,7 @@ _kube_ps1_get_context_ns() {
# Set the command time # Set the command time
if [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then if [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
if ((BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 2))); then if ((BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 2))); then
_KUBE_PS1_LAST_TIME=$(printf '%(%s)T') printf -v _KUBE_PS1_LAST_TIME '%(%s)T' -1
else else
_KUBE_PS1_LAST_TIME=$(date +%s) _KUBE_PS1_LAST_TIME=$(date +%s)
fi fi
@@ -407,8 +431,11 @@ kubeoff() {
# Build our prompt # Build our prompt
kube_ps1() { kube_ps1() {
[[ "${KUBE_PS1_ENABLED}" == "off" ]] && return [[ "${KUBE_PS1_ENABLED}" == "off" ]] && return
[[ "${KUBE_PS1_HIDE_IF_NOCONTEXT}" == true ]] &&
[[ "${_KUBE_PS1_HAS_CONTEXT}" == false ]] && return
[[ -z "${KUBE_PS1_CONTEXT}" ]] && [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]] && return [[ -z "${KUBE_PS1_CONTEXT}" ]] && [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]] && return
[[ "${KUBE_PS1_CONTEXT}" == "N/A" ]] && [[ ${KUBE_PS1_HIDE_IF_NOCONTEXT} == true ]] && return
local KUBE_PS1 local KUBE_PS1
local KUBE_PS1_RESET_COLOR="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_FG}${_KUBE_PS1_CLOSE_ESC}" local KUBE_PS1_RESET_COLOR="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_FG}${_KUBE_PS1_CLOSE_ESC}"
+2 -2
View File
@@ -12,8 +12,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_kubectl" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kubectl"
zf_mv -f -- =( kubectl completion zsh 2> /dev/null ) "$TMPPREFIX" zf_mv -f -- =( kubectl completion zsh 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_kubectl"
} &| } &|
# This command is used a LOT both below and in daily life # This command is used a LOT both below and in daily life
+15
View File
@@ -6,6 +6,21 @@ This plugin adds aliases and autocompletion for Laravel [Artisan](https://larave
plugins=(... laravel) plugins=(... laravel)
``` ```
## Settings
By default the aliases run `php artisan`. To use a different PHP command, such as
`herd php` (which runs the PHP version the [Laravel Herd](https://herd.laravel.com) site
is isolated to, instead of Herd's global version) or a specific version like `php8.4`,
set this before Oh My Zsh is sourced:
```zsh
zstyle ':omz:plugins:laravel' php 'herd php'
```
`php` in the aliases below is then replaced with that command.
## Aliases
| Alias | Description | | Alias | Description |
|:-:|:-:| |:-:|:-:|
| `artisan` | `php artisan` | | `artisan` | `php artisan` |
+44 -39
View File
@@ -1,51 +1,56 @@
#!zsh #!zsh
alias artisan='php artisan' # Command used to run artisan, e.g. `herd php` or `php8.4` (default: `php`)
alias bob='php artisan bob::build' zstyle -s ':omz:plugins:laravel' php _omz_laravel_php || _omz_laravel_php=php
alias artisan="$_omz_laravel_php artisan"
alias bob="$_omz_laravel_php artisan bob::build"
# Development # Development
alias pas='php artisan serve' alias pas="$_omz_laravel_php artisan serve"
alias pad='php artisan dev' alias pad="$_omz_laravel_php artisan dev"
alias pats='php artisan test' alias pats="$_omz_laravel_php artisan test"
# Database # Database
alias pam='php artisan migrate' alias pam="$_omz_laravel_php artisan migrate"
alias pamf='php artisan migrate:fresh' alias pamf="$_omz_laravel_php artisan migrate:fresh"
alias pamfs='php artisan migrate:fresh --seed' alias pamfs="$_omz_laravel_php artisan migrate:fresh --seed"
alias pamr='php artisan migrate:rollback' alias pamr="$_omz_laravel_php artisan migrate:rollback"
alias pads='php artisan db:seed' alias pads="$_omz_laravel_php artisan db:seed"
alias padw='php artisan db:wipe' alias padw="$_omz_laravel_php artisan db:wipe"
# Makers # Makers
alias pamm='php artisan make:model' alias pamm="$_omz_laravel_php artisan make:model"
alias pamc='php artisan make:controller' alias pamc="$_omz_laravel_php artisan make:controller"
alias pams='php artisan make:seeder' alias pams="$_omz_laravel_php artisan make:seeder"
alias pamt='php artisan make:test' alias pamt="$_omz_laravel_php artisan make:test"
alias pamfa='php artisan make:factory' alias pamfa="$_omz_laravel_php artisan make:factory"
alias pamp='php artisan make:policy' alias pamp="$_omz_laravel_php artisan make:policy"
alias pame='php artisan make:event' alias pame="$_omz_laravel_php artisan make:event"
alias pamj='php artisan make:job' alias pamj="$_omz_laravel_php artisan make:job"
alias paml='php artisan make:listener' alias paml="$_omz_laravel_php artisan make:listener"
alias pamn='php artisan make:notification' alias pamn="$_omz_laravel_php artisan make:notification"
alias pampp='php artisan make:provider' alias pampp="$_omz_laravel_php artisan make:provider"
alias pamcl='php artisan make:class' alias pamcl="$_omz_laravel_php artisan make:class"
alias pamen='php artisan make:enum' alias pamen="$_omz_laravel_php artisan make:enum"
alias pami='php artisan make:interface' alias pami="$_omz_laravel_php artisan make:interface"
alias pamtr='php artisan make:trait' alias pamtr="$_omz_laravel_php artisan make:trait"
alias pamv='php artisan make:view' alias pamv="$_omz_laravel_php artisan make:view"
alias pammig='php artisan make:migration' alias pammig="$_omz_laravel_php artisan make:migration"
# Clears # Clears
alias pacac='php artisan cache:clear' alias pacac="$_omz_laravel_php artisan cache:clear"
alias pacoc='php artisan config:clear' alias pacoc="$_omz_laravel_php artisan config:clear"
alias pavic='php artisan view:clear' alias pavic="$_omz_laravel_php artisan view:clear"
alias paroc='php artisan route:clear' alias paroc="$_omz_laravel_php artisan route:clear"
alias paopc='php artisan optimize:clear' alias paopc="$_omz_laravel_php artisan optimize:clear"
# queues # queues
alias paqf='php artisan queue:failed' alias paqf="$_omz_laravel_php artisan queue:failed"
alias paqft='php artisan queue:failed-table' alias paqft="$_omz_laravel_php artisan queue:failed-table"
alias paql='php artisan queue:listen' alias paql="$_omz_laravel_php artisan queue:listen"
alias paqr='php artisan queue:retry' alias paqr="$_omz_laravel_php artisan queue:retry"
alias paqt='php artisan queue:table' alias paqt="$_omz_laravel_php artisan queue:table"
alias paqw='php artisan queue:work' alias paqw="$_omz_laravel_php artisan queue:work"
unset _omz_laravel_php
+18
View File
@@ -0,0 +1,18 @@
# logcli plugin
This plugin adds completion for [Grafana Loki's logcli](https://grafana.com/docs/loki/latest/query/logcli/).
To use it, add `logcli` to the plugins array in your zshrc file:
```zsh
plugins=(... logcli)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script and automatically updates it when the
plugin is loaded, which is usually when you start a new terminal emulator.
The cache is stored at `$ZSH_CACHE_DIR/completions/_logcli`.
+18
View File
@@ -0,0 +1,18 @@
# Autocompletion for Grafana Loki's CLI (logcli).
if (( ! $+commands[logcli] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `logcli`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_logcli" ]]; then
typeset -g -A _comps
autoload -Uz _logcli
_comps[logcli]=_logcli
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._logcli"
zf_mv -f -- =( logcli --completion-script-zsh ) "$ZSH_CACHE_DIR/completions/_logcli"
} &|
+2 -2
View File
@@ -12,6 +12,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_minikube" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._minikube"
zf_mv -f -- =( minikube completion zsh ) "$TMPPREFIX" zf_mv -f -- =( minikube completion zsh ) "$ZSH_CACHE_DIR/completions/_minikube"
} &| } &|
+11 -8
View File
@@ -1,5 +1,5 @@
if (( $+commands[mise] )); then if (( $+commands[mise] )); then
_mise_bin=mise _mise_bin=$commands[mise]
elif [[ -x ~/.local/bin/mise ]]; then elif [[ -x ~/.local/bin/mise ]]; then
_mise_bin=~/.local/bin/mise _mise_bin=~/.local/bin/mise
else else
@@ -8,7 +8,6 @@ fi
# Load mise hooks # Load mise hooks
eval "$($_mise_bin activate zsh)" eval "$($_mise_bin activate zsh)"
unset _mise_bin
# If the completion file doesn't exist yet, we need to autoload it and # If the completion file doesn't exist yet, we need to autoload it and
# bind it to `mise`. Otherwise, compinit will have already done that. # bind it to `mise`. Otherwise, compinit will have already done that.
@@ -18,9 +17,13 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_mise" ]]; then
_comps[mise]=_mise _comps[mise]=_mise
fi fi
# Generate and load mise completion # Generate completion only when missing/empty or stale relative to the mise binary.
zmodload -F zsh/files b:zf_mv if [[ ! -s "$ZSH_CACHE_DIR/completions/_mise" || "$_mise_bin" -nt "$ZSH_CACHE_DIR/completions/_mise" ]]; then
() { zmodload -F zsh/files b:zf_mv
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_mise" () {
zf_mv -f -- =( mise completion zsh ) "$TMPPREFIX" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._mise"
} &| zf_mv -f -- =( "$_mise_bin" completion zsh ) "$ZSH_CACHE_DIR/completions/_mise"
} &|
fi
unset _mise_bin
+2 -2
View File
@@ -13,8 +13,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_molecule" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._molecule"
zf_mv -f -- =( _MOLECULE_COMPLETE=zsh_source molecule ) "$TMPPREFIX" zf_mv -f -- =( _MOLECULE_COMPLETE=zsh_source molecule ) "$ZSH_CACHE_DIR/completions/_molecule"
} &| } &|
# Alias # Alias
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff. Show more