Compare commits

..

No commits in common. "main" and "v2.12" have entirely different histories.
main ... v2.12

230 changed files with 121644 additions and 24948 deletions

View file

@ -1,10 +0,0 @@
.git/
.github/
.git*
doc/
scripts/
test/
tests/
*.zwc
Makefile

16
.gitattributes vendored
View file

@ -1,16 +0,0 @@
# By default, everything is text
* text=auto
# These must be unix EOLs
*.sh eol=lf
*.zsh diff=zsh eol=lf
*.zunit diff=zsh eol=lf
Makefile eol=lf
# Use the markdown differ.
*.md diff=markdown
# Binary files
*.png binary
# EOF

3
.github/CODEOWNERS vendored
View file

@ -1,3 +0,0 @@
* @alichtman @pschmitt @vladdoster
# Should consider adding @psprint as well

View file

@ -1,99 +0,0 @@
name: Bug Report
description: File a bug report
title: "[bug]: "
labels: ["bug", "triage"]
assignees:
- vladdoster
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
## Self Check
- Look for similar errors in existing [GitHub Issues](https://github.com/zdharma-continuum/zinit/issues?q=is%3Aissue) (open or closed).
- Try reaching out on the [Gitter server](https://matrix.to/#/#zdharma-continuum_community:gitter.im) for help.
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
validations:
required: true
- type: textarea
validations:
required: true
attributes:
label: Steps to reproduce
description: |
Steps to reproduce the problem
placeholder: |
1. Enable plugin 'foo'
2. Run 'foo bar' or try to complete command 'foo --widget'
3. See error
- type: textarea
id: logs
attributes:
label: Relevant output
description: Please copy and paste any relevant output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: textarea
attributes:
label: Screenshots and recordings
description: |
If applicable, add screenshots or [asciinema](https://asciinema.org) session to explain your problem
- type: input
validations:
required: true
attributes:
label: Operating System & Version
description: |
Output of
```
echo "OS: ${OSTYPE:-N/A} | Vendor: ${VENDOR:-N/A} | Machine: ${MACHTYPE:-N/A} | CPU: ${CPUTYPE:-N/A} | Processor: ${$(uname -p 2>/dev/null):-N/A} | Hardware: ${$(uname -m 2>/dev/null):-N/A}"
```
- type: input
validations:
required: true
attributes:
label: Zsh version
description: Output of `zsh --version`
- type: input
validations:
required: true
attributes:
label: Terminal emulator
description: Terminal name & output of `echo "${TERM}"`
- type: dropdown
attributes:
label: If using WSL on Windows, which version of WSL
description: Output `wsl -l -v`
options:
- 'WSL 1'
- 'WSL 2'
- type: textarea
attributes:
label: Additional context
description: Add any other context about the problem. This can be themes, plugins, custom settings, etc.
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](../../CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true

24
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help Zplugin improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Versions:**
- $ZSH_VERSION == ...
- Operating system name and version (uname -a): ...
**Additional context**
Add any other context about the problem here.

View file

@ -1,8 +0,0 @@
blank_issues_enabled: true
contact_links:
- name: Support
url: https://github.com/zdharma-continuum/zinit/discussions
about: Ask the community for support
- name: Get help on Matrix
url: https://matrix.to/#/#zdharma-continuum_community:gitter.im
about: Have a quick question? Join the Gitter community and ask your question.

View file

@ -1,32 +0,0 @@
name: Documentation
description: Create a report to help us improve the documentation
labels: [documentation]
title: "[doc]: "
body:
- type: input
id: link
attributes:
label: Documentation Link
description: |
Link to any documentation or examples that you are referencing.
Suggested improvements should be based on the development version of the docs: https://zdharma-continuum.github.io/zinit/wiki/
placeholder: https://zdharma-continuum.github.io/zinit/wiki/...
- type: textarea
id: problem
attributes:
label: Problem
description: What is missing, unclear, or wrong in the documentation?
placeholder: |
* I found [...] to be unclear because [...]
* [...] made me think that [...] when really it should be [...]
* There is no example showing how to do [...]
validations:
required: true
- type: textarea
id: improvement
attributes:
label: Suggested improvement
placeholder: |
* This line should be be changed to say [...]
* Include a paragraph explaining [...]
* Add a figure showing [...]

View file

@ -1,38 +0,0 @@
name: Feature request
description: Suggest a feature for Zinit
labels: ["feature"]
title: "[feat]: "
body:
- type: markdown
attributes:
value: |
## Self Check
- Look for similar features in existing [GitHub Issues](https://github.com/zdharma-continuum/zinit/issues?q=is%3Aissue) (open or closed).
- type: input
attributes:
label: If the feature request is for a plugin or theme, specify it here.
description: The name of the plugin or theme that you would like us to improve.
placeholder: e.g. Git plugin, Agnoster theme
- type: textarea
attributes:
label: If the feature solves a problem you have, specify it here.
description: A description of what the problem is.
placeholder: Ex. I'm always frustrated when...
- type: textarea
attributes:
label: Describe the proposed feature.
description: A description of what you want to happen. Be as specific as possible.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A description of any alternative solutions or features you've considered. This can also include other plugins or themes.
- type: textarea
attributes:
label: Additional context
description: Add any other context, screenshots or Gitter conversations about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at.
- type: textarea
attributes:
label: Related Issues
description: Is there any open or closed issues that is related to this feature request? If so please link them below!

View file

@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -1,17 +0,0 @@
name: Maintenance
description: Help improve performance, usability and/or consistency.
title: "[maint]: "
labels: [Maintenance]
body:
- type: textarea
id: summary
attributes:
label: Summary
description: Please provide 1-2 short sentences that succinctly describes what could be improved.
validations:
required: true
- type: textarea
id: fix
attributes:
label: Proposed fix
description: Please describe how you think this could be improved.

View file

@ -1,7 +0,0 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

41
.github/labeler.yml vendored
View file

@ -1,41 +0,0 @@
ci/cd:
- changed-files:
- any-glob-to-any-file: '.github/**'
docker:
- changed-files:
- any-glob-to-any-file: 'docker/**'
scripts:
- changed-files:
- any-glob-to-any-file: 'docker/**'
tests:
- changed-files:
- any-glob-to-any-file: ['.zunit.yml', 'tests/**/*']
completion:
- changed-files:
- any-glob-to-any-file: '_zinit'
# Add 'Documentation' label to any file changes within 'docs' folder
docs:
- changed-files:
- any-glob-to-any-file: 'doc/**'
- any-glob-to-any-file: '**/*.md'
# Add 'source' label to any change to src files within the source dir EXCEPT for the docs sub-folder
zinit:
- changed-files:
- any-glob-to-any-file: 'zinit*.zsh*'
# Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
feature:
- head-branch: ['^feat']
fix:
- head-branch: ['^fix']
# Add 'release' label to any PR that is opened against the `main` branch
release:
- base-branch: 'main'

38
.github/stale.yml vendored
View file

@ -1,38 +0,0 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 180
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
daysUntilClose: 7
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone
exemptMilestones: false
# Set to true to ignore issues with an assignee
exemptAssignees: false
# Label to use when marking as stale
staleLabel: stale
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
# configuration settings that are specific to just 'issues' or 'pulls':
pulls:
daysUntilStale: 30
markComment: >
This pull request has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
unmarkComment: >
This pull request has been automatically marked as not stale anymore due to the recent activity.
closeComment: >
This pull request has been automatically closed because it had not recent activity during the stale period.
issues:
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
unmarkComment: >
This issue has been automatically marked as not stale anymore due to the recent activity.
closeComment: >
This issue has been automatically closed because it had not recent activity during the stale period.

View file

@ -1,24 +0,0 @@
name: Bump Homebrew Formula
on:
workflow_dispatch:
push:
tags:
- '*'
jobs:
bump-homebrew-formula:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Bump Homebrew formulae
uses: dawidd6/action-homebrew-bump-formula@v8
with:
formula: zinit
# A Personal Access Token (PAT) is instead of the default
# GITHUB_TOKEN because brew bump-formula-pr creates a fork of the
# formula's tap repository (if needed) and then creates a pull
# request.
token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}

View file

@ -1,99 +0,0 @@
name: Container images
on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+
workflow_dispatch:
jobs:
build-containers-with-zsh:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
zsh_version:
- 5.8
- 5.9
steps:
- name: check out repository code
uses: actions/checkout@v7
- name: Grab git slugs (short commit id, branch etc.)
uses: rlespinasse/github-slug-action@v3.x
- name: set up qemu
uses: docker/setup-qemu-action@v4
- name: setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v4
with:
install: true
use: true
- name: login to github container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build and push
id: docker_build_zsh_versions
uses: docker/build-push-action@v7
timeout-minutes: 90 # compiling older zsh versions take a long time
with:
push: ${{ github.event.number == 0 }}
file: ./docker/Dockerfile
build-args: |
ZINIT_ZSH_VERSION=${{ matrix.zsh_version }}-tcsetpgrp
tags: |
ghcr.io/${{ github.repository }}:zsh-${{ matrix.zsh_version }}
ghcr.io/${{ github.repository }}:zsh-${{ matrix.zsh_version }}-${{ env.GITHUB_SHA_SHORT }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=gha
cache-to: type=gha,mode=max
build-container-latest:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v7
- name: get vcs details
uses: rlespinasse/github-slug-action@v3.x
- name: setup docker qemu
uses: docker/setup-qemu-action@v4
- name: setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v4
with:
install: true
use: true
- name: github container registry authentication
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build & push new image
id: docker_build_latest
uses: docker/build-push-action@v7
if: github.ref == 'refs/heads/main'
with:
push: true
file: ./docker/Dockerfile
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.GITHUB_SHA_SHORT }}
ghcr.io/${{ github.repository }}:${{ env.GITHUB_REF_SLUG }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=gha
cache-to: type=gha,mode=max

View file

@ -1,41 +0,0 @@
name: Documentation
on:
pull_request:
branches:
- main
paths:
- 'zinit*.zsh'
push:
branches:
- main
paths:
- 'zinit*.zsh'
workflow_dispatch:
jobs:
zshelldoc:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v7
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- name: re-generate documentation
run: |
make doc/container
sudo chown -R "$(id -u):$(id -g)" .
- name: commit and push updated docs
if: github.event_name != 'pull_request'
uses: EndBug/add-and-commit@v11
with:
add: 'doc'
author_name: GitHub Actions
author_email: actions@github.com
commit: --signoff
message: 'docs: generate'
push: true

View file

@ -1,67 +0,0 @@
# name: Installer
# concurrency:
# cancel-in-progress: true
# group: ${{ github.workflow }}-${{ github.ref }}
# defaults:
# run:
# shell: bash
# env:
# NO_INPUT: true
# TERM: xterm
# ZINIT_BRANCH: ${{ github.ref_name }}
# ZINIT_COMMIT: ${{ github.sha }}
# ZINIT_REPO: ${{ github.repository }}
# on:
# pull_request:
# branches:
# - main
# paths:
# - .github/workflows/installer.yaml
# - scripts/**
# - share/**
# - zinit*.zsh
# push:
# branches:
# - main
# workflow_dispatch:
# jobs:
# zinit-installer:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: true
# matrix:
# annexes: ["with annexes", "no annexes"]
# os: [macos-latest, ubuntu-latest, windows-latest]
# steps:
# - name: check out repository
# uses: actions/checkout@v3
# - name: windows dependencies
# if: runner.os == 'Windows'
# uses: egor-tensin/setup-cygwin@v3
# with:
# platform: x64
# packages: curl git zsh
# - name: remove \r
# if: runner.os == 'Windows'
# run: sed -i 's/\r$//' scripts/*.sh
# - name: linux/macos dependencies
# if: runner.os != 'Windows'
# run: brew install --force curl subversion unzip xz zsh
# - name: install
# run: ./scripts/install.sh
# - name: verify install
# run: zsh -silc 'zinit --help'

View file

@ -1,19 +0,0 @@
name: label
on:
pull_request_target: # https://securitylab.github.com/research/github-actions-preventing-pwn-requests
jobs:
label-pull-requests:
name: "pull requests"
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v7
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true

View file

@ -1,82 +0,0 @@
name: lint
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
commit:
name: "commit convention"
uses: zdharma-continuum/.github/.github/workflows/commit-job.yml@main
mdlint:
name: markdown
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: xt0rted/markdownlint-problem-matcher@v3
- run: npm install -g markdownlint-cli@0.44.0
# disabled checks:
# MD013/line-length
# MD024/no-duplicate-heading
# MD033/no-inline-html
# MD034/no-bare-urls
# MD036/no-emphasis-as-heading
# MD041/first-line-heading/first-line-h1
# MD059/descriptive-link-text
# MD060/table-column-style
- run: |
markdownlint --version
# List files to lint
ls *.md **/*.md
markdownlint \
--disable MD013 MD024 MD029 MD033 MD034 MD036 MD041 MD059 MD060 \
--ignore '**/CHANGELOG.md' \
-- *.md **/*.md
zshlint:
name: zsh
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
task: [noexec, zcompile]
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v7
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install --yes zsh
- name: "run lint (${{ matrix.task }})"
run: |
case "${{ matrix.task }}" in
noexec)
find . -name '*.zsh' -type f -print0 \
| xargs -0 -n1 -P4 zsh -n
;;
zcompile)
find . -name '*.zsh' -type f \
-exec zsh -fc "zcompile {}" \;
;;
*)
echo "ERROR: unknown task ${{ matrix.task }}" >&2
exit 1
;;
esac

View file

@ -1,32 +0,0 @@
name: Release
on:
workflow_dispatch:
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '20'
- name: Fetch dependencies
run: |
npm install --no-package-lock \
@semantic-release/changelog @semantic-release-plus/docker @semantic-release/exec @semantic-release/git \
conventional-changelog-eslint @google/semantic-release-replace-plugin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Generate release
run: npx semantic-release --ci --
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_EMAIL: 'mvdoster@gmail.com'
GIT_AUTHOR_NAME: 'Vladislav Doster'
GIT_COMMITTER_EMAIL: 'mvdoster@gmail.com'
GIT_COMMITTER_NAME: 'Vladislav Doster'

View file

@ -1,105 +0,0 @@
name: tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 0
HOMEBREW_NO_REQUIRE_TAP_TRUST: 1
TERM: xterm-256color
# TERM: dumb
on:
pull_request:
branches:
- main
paths:
- "tests/**"
- "share/**"
- "zinit*.zsh"
- ".github/workflows/tests.yaml"
push:
branches:
- main
workflow_dispatch:
jobs:
zunit-tests:
name: "${{ matrix.zunit_test }} | ${{ matrix.os }}"
runs-on: "${{ matrix.os }}-latest"
strategy:
fail-fast: false
matrix:
zunit_test:
- annexes
- commands
- compile
- config-zstyle
- gh-r
- hook-handler
- ice-validation
- ices
- plugins
- snippets
os: [macos, ubuntu]
include:
- zunit_test: gh-r
zunit_flag: --slice
- zunit_test: plugins
zunit_flag: --slice
steps:
- name: "checkout ${{ github.repository }}"
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: "install homebrew"
id: setup-homebrew
uses: Homebrew/actions/setup-homebrew@f8d4222eb633e65c2a0157383cf80861fc7fae7f
- name: "install ${{ runner.os }} dependencies"
if: runner.os == 'Linux'
run: |
sudo apt-get update --yes
sudo apt-get install --no-install-recommends --yes \
autoconf automake autotools-dev \
build-essential byacc \
file \
gcc gettext glibc-source grep \
libc6 libc6-dev libevent-dev libncurses5-dev libncursesw5-dev libtool libuvc0 lua5.1 \
m4 \
ninja-build \
pkg-config \
xz-utils \
zsh \
zstd
- name: "install dependencies via brew"
id: install-deps
run: |
brew install --quiet --force --overwrite autoconf automake binutils byacc coreutils curl gettext gnu-sed jemalloc libevent libtool libuv lua lua@5.4 make ninja parallel pkg-config texinfo unzip xz zsh zstd
brew unlink ncurses && brew link --force ncurses
- name: "checkout zdharma-continuum/zunit"
uses: actions/checkout@v7
with:
repository: "zdharma-continuum/zunit"
path: zunit
ref: "feat/run-tests-in-parallel-support"
- name: "install zunit"
id: install-zunit
shell: zsh {0}
working-directory: zunit
run: |
mkdir -p "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
./configure --prefix=${HOME}/.local
make all install
- name: "run ${{ matrix.zunit_test }} tests"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: zunit run ${{ matrix.zunit_flag }} tests/${{ matrix.zunit_test }}.zunit

111
.gitignore vendored
View file

@ -1,24 +1,95 @@
*.[aos]
*.bundle
*.dll
tags
TAGS
*.o
*.o.c
*.orig
*.txt
*.zini
*.zwc
*deploy*key*
*.a
*.so
*.dll
*~
.*.sw?
.project
TAGS
TODO*
\#*
doc/zsdoc/data
other
site*/
tags
test/
txt/
zmodules/
tests/_output/
tests/_support/tmp*
.idea
/zmodules/META-FAQ
/zmodules/config.cache
/zmodules/config.h
/zmodules/config.log
/zmodules/config.modules
/zmodules/config.modules.sh
/zmodules/config.status
/zmodules/config.status.lineno
/zmodules/cscope.out
/zmodules/stamp-h
/zmodules/autom4te.cache
zmodules/Config/defs.mk
CVS
.#*
zmodules/Src/*.epro
zmodules/Src/*.export
zmodules/Src/*.mdh
zmodules/Src/*.mdh.tmp
zmodules/Src/*.mdhi
zmodules/Src/*.mdhs
zmodules/Src/*.syms
zmodules/Src/Makemod.in
zmodules/Src/Makemod
zmodules/Src/[_a-zA-Z0-9]*.pro
zmodules/Src/ansi2knr
zmodules/Src/bltinmods.list
zmodules/Src/cscope.out
zmodules/Src/libzsh.so*
zmodules/Src/modules-bltin
zmodules/Src/modules.index
zmodules/Src/modules.index.tmp
zmodules/Src/modules.stamp
zmodules/Src/patchlevel.h
zmodules/Src/sigcount.h
zmodules/Src/signames.c
zmodules/Src/signames2.c
zmodules/Src/stamp-modobjs
zmodules/Src/stamp-modobjs.tmp
zmodules/Src/tags
zmodules/Src/TAGS
zmodules/Src/version.h
zmodules/Src/zshcurses.h
zmodules/Src/zshpaths.h
zmodules/Src/zshterm.h
zmodules/Src/zshxmods.h
zmodules/Src/zdharma/Makefile.in
zmodules/Src/zdharma/*.export
zmodules/Src/zdharma/so_locations
zmodules/Src/zdharma/*.pro
zmodules/Src/zdharma/*.epro
zmodules/Src/zdharma/*.syms
zmodules/Src/zdharma/*.mdh
zmodules/Src/zdharma/*.mdhi
zmodules/Src/zdharma/*.mdhs
zmodules/Src/zdharma/*.mdh.tmp
zmodules/Src/zdharma/errnames.c
zmodules/Src/zdharma/errcount.h
zmodules/Src/zdharma/curses_keys.h
test/test_plugins/zsh-select/.git
test/test_plugins/zsh-select/.test_git/COMMIT_EDITMSG
test/test_plugins/zsh-select-more/.test_git/COMMIT_EDITMSG
test/test_plugins/ice-order/.test_git/COMMIT_EDITMSG
*.zwc
answer
test/data
test/zplugin*.zsh
test/_zplugin
*.txt
*.zini
.ycm_extra_conf.py
zmodules/COMPILED_AT
zmodules/Src/*.dSYM
zmodules/Src/zdharma/*.dSYM
zmodules/Test/*.tmp
/.project
zmodules/ValTest/test_type
/*deploy*key*

1
.mailmap Normal file
View file

@ -0,0 +1 @@
SG <sgniazdowski@gmail.com>

View file

@ -1,47 +0,0 @@
{
"repositoryUrl": "https://github.com/zdharma-continuum/zinit.git",
"branches": [
"main"
],
"plugins": [
[ "@semantic-release/commit-analyzer", { } ],
[
"@google/semantic-release-replace-plugin",
{
"replacements": [
{
"files": [
"VERSION"
],
"from": "^([0-9]).+([0-9]).+([0-9])$",
"to": "${nextRelease.version}",
"results": [
{
"file": "VERSION",
"hasChanged": true
}
]
}
]
}
],
[ "@semantic-release/release-notes-generator", { } ],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"VERSION"
],
"message": "release: v${lastRelease.version} → v${nextRelease.version}\n\n${nextRelease.notes}"
}
],
"@semantic-release/github"
]
}

44
.travis.yml Normal file
View file

@ -0,0 +1,44 @@
language: ruby
dist: trusty
rvm:
- 2.4
install: gem install asciidoctor-pdf --pre
git:
depth: 1
branches:
only:
- master
addons:
apt:
packages:
- zsh
env:
global:
- ENCRYPTION_LABEL: "de1faff15945"
- COMMIT_AUTHOR_EMAIL: "psprint@zdharma.org"
before_script:
- zsh --version
- >-
zsh -c 'print -rl -- "ZSH_VERSION: $ZSH_VERSION" "ZSH_PATCHLEVEL: $ZSH_PATCHLEVEL" "OSTYPE: $OSTYPE" "CPUTYPE: $CPUTYPE" "MACHTYPE: $MACHTYPE"'
script:
- git fetch --depth=1 origin tests:tests
- git worktree add test tests
- make
- make test VERBOSE=1
- make testB VERBOSE=1
- make testC VERBOSE=1
- make testD VERBOSE=1
- make testE VERBOSE=1
- make -C zsdoc pdf
- share/deploy_doc.sh
notifications:
irc:
channels:
- "chat.freenode.net#zplugin"
on_success: change # default: always
on_failure: always # default: always
skip_join: false

View file

@ -1,14 +0,0 @@
allow_risky: false
directories:
output: tests/_output
support: tests/_support
tests: tests
fail_fast: false
# Both parallel keys stay false, and the flags stay on the command line.
# zunit's config booleans are one-way -- there is no --no-parallel or
# --no-verbose -- so a `true' here could never be turned off again, not even
# for `zunit run tests/commands.zunit@"help"'. parallel_slice additionally
# implies parallel, and only does anything for a run that queues one file.
parallel: false
parallel_slice: false
verbose: false

View file

@ -1,278 +0,0 @@
# [3.17.0](https://github.com/zdharma-continuum/zinit/compare/v3.16.0...v3.17.0) (2026-09-02)
### Features
* **ziextract:** support zst archive format ([b8855c7](https://github.com/zdharma-continuum/zinit/commit/b8855c7887e26f79934b6122232b141cdd3106bf))
# [3.16.0](https://github.com/zdharma-continuum/zinit/compare/v3.15.3...v3.16.0) (2026-08-31)
### Bug Fixes
* **self-update:** honor -q in changelog display ([a85e9dc](https://github.com/zdharma-continuum/zinit/commit/a85e9dcc3ee2beebf3947ef6091ccd540d94f6f3))
### Features
* **self-update:** support -n/--no-pager ([cc3baf3](https://github.com/zdharma-continuum/zinit/commit/cc3baf395fa51de11e7d76b11104e36d8d142601)), closes [#632](https://github.com/zdharma-continuum/zinit/issues/632)
## [3.15.3](https://github.com/zdharma-continuum/zinit/compare/v3.15.2...v3.15.3) (2026-08-28)
### Bug Fixes
* **install:** retry and auth github api downloads ([eaa1056](https://github.com/zdharma-continuum/zinit/commit/eaa10566992e8371a27fbb1300e6fdc2e4161f17)), closes [#r](https://github.com/zdharma-continuum/zinit/issues/r)
## [3.15.2](https://github.com/zdharma-continuum/zinit/compare/v3.15.1...v3.15.2) (2026-08-28)
### Bug Fixes
* **install:** treat non-archive single file gracefully in ziextract. ([981cb15](https://github.com/zdharma-continuum/zinit/commit/981cb1582ece95dfad9d6c53d34a601f6b25391f)), closes [#771](https://github.com/zdharma-continuum/zinit/issues/771) [#r](https://github.com/zdharma-continuum/zinit/issues/r) [Pre-#771](https://github.com/Pre-/issues/771)
## [3.15.1](https://github.com/zdharma-continuum/zinit/compare/v3.15.0...v3.15.1) (2026-08-27)
### Bug Fixes
* **ices:** expand the atinit'!' ice correctly ([ed80701](https://github.com/zdharma-continuum/zinit/commit/ed807014262aca939d24d9e0e9356aa64ad5ae73))
* **ices:** restore $OLDPWD around plugin directory hooks ([712cac1](https://github.com/zdharma-continuum/zinit/commit/712cac1952fb4d35861082748068ae33c757f125))
* **ices:** restore cwd even when the ice body cds ([264526a](https://github.com/zdharma-continuum/zinit/commit/264526ab26715e54fdc7fa36d5b23b881459e19f))
* **install:** restore cwd after the configure hook ([d875651](https://github.com/zdharma-continuum/zinit/commit/d875651d5986f42b6ba8b37ca07f66d45d083749))
* **install:** restore cwd on early atclone return ([736403c](https://github.com/zdharma-continuum/zinit/commit/736403cb39e66ec7da7c4c373fdb99961bde5a83))
# [3.15.0](https://github.com/zdharma-continuum/zinit/compare/v3.14.0...v3.15.0) (2026-07-01)
### Bug Fixes
* .zi-check-for-git-changes runs git fetch before checking for changes ([1107460](https://github.com/zdharma-continuum/zinit/commit/1107460bcd533c1a9003d1cf3db2918425f11c4a))
* add markdownlint exceptions to linting ([507b4e5](https://github.com/zdharma-continuum/zinit/commit/507b4e5722ecfde21c42cc4e6502b0049e3ef192))
* avoid apostrophe that breaks typeset -f round-trip of :zinit-tmp-subst-autoload ([#783](https://github.com/zdharma-continuum/zinit/issues/783)) ([d2d4237](https://github.com/zdharma-continuum/zinit/commit/d2d4237715081ea138eb1a9d4a7d1634eec7a36e))
* correct SSH URL format for private repos ([#721](https://github.com/zdharma-continuum/zinit/issues/721)) ([991e4a8](https://github.com/zdharma-continuum/zinit/commit/991e4a816efc426bb1c2c0b13a01acff298b8005))
* corrected print-out message in self-update routine ([bb37f3b](https://github.com/zdharma-continuum/zinit/commit/bb37f3bbd829485b006ef95ca24edbb462347731))
* impl gh-r version detection using GitHub API ([#731](https://github.com/zdharma-continuum/zinit/issues/731)) ([f1e503d](https://github.com/zdharma-continuum/zinit/commit/f1e503dc3b6ac689331180e577b4e7da79e17b02)), closes [#r](https://github.com/zdharma-continuum/zinit/issues/r)
* prevent "permission denied" errors from empty hook handlers ([#729](https://github.com/zdharma-continuum/zinit/issues/729)) ([2167408](https://github.com/zdharma-continuum/zinit/commit/2167408db27720031983d1067c156837cf522ff3))
* prevent double extraction when exclamation mark modifier is used in extract'!' ([4fd38b3](https://github.com/zdharma-continuum/zinit/commit/4fd38b34e76fb97fb20d2345256e80526a4921c8)), closes [#r](https://github.com/zdharma-continuum/zinit/issues/r) [#r](https://github.com/zdharma-continuum/zinit/issues/r)
* remove `local -A OPTS` that shadows caller's parallel flag ([#774](https://github.com/zdharma-continuum/zinit/issues/774)) ([e88ed77](https://github.com/zdharma-continuum/zinit/commit/e88ed77319c9a2e0187b964f9ad99f17a33d5999))
* resolve a bug where the `-q` option for quiet mode was never dispatched ([6cf2f29](https://github.com/zdharma-continuum/zinit/commit/6cf2f2990d45d72f58d88433c9831b2ea64e8d76))
* resolve a second issue where `git -C <path>` had to be used instead of `git --work-tree <path>` ([2e83176](https://github.com/zdharma-continuum/zinit/commit/2e83176b23d7be5db48c8bfcdea67197692d2569))
* resolves a bug with github action trying to push updated docs back to external forks ([#763](https://github.com/zdharma-continuum/zinit/issues/763)) ([34a1811](https://github.com/zdharma-continuum/zinit/commit/34a18112e8866a7a7570b0ee1da44298677cc8d2))
* silenced `zinit self-update` when in quiet mode (`-q`) ([8d154b0](https://github.com/zdharma-continuum/zinit/commit/8d154b0609e1dbb0387fb15cd93507c794ee9ec2))
* trust archive permissions instead of `file(1)` heuristics in `ziextract` ([#771](https://github.com/zdharma-continuum/zinit/issues/771)) ([1334994](https://github.com/zdharma-continuum/zinit/commit/1334994f20d58e7279d308401dea2b680c0cade1))
* update `git-chglog` to `git-cliff` in gh-r tests ([18fc2cc](https://github.com/zdharma-continuum/zinit/commit/18fc2cc5b903450d17f340898e4abbbb48ad975c)), closes [#r](https://github.com/zdharma-continuum/zinit/issues/r)
* Update various tools in gh-r tests ([#759](https://github.com/zdharma-continuum/zinit/issues/759)) ([01eb65f](https://github.com/zdharma-continuum/zinit/commit/01eb65f8cea521779dd0eb23ac1d92239e36d8d6)), closes [#r](https://github.com/zdharma-continuum/zinit/issues/r)
### Features
* validate ice arguments ([#778](https://github.com/zdharma-continuum/zinit/issues/778)) ([424b241](https://github.com/zdharma-continuum/zinit/commit/424b241bc7112bde7bfb906f8726b43bed0ecd1f))
* **zsh:** allow configuring settings like HOME_DIR/BIN_DIR via zstyle ([8f89f88](https://github.com/zdharma-continuum/zinit/commit/8f89f88cfdda42afbf5e1f7a3f2d510caff7354d))
## [3.13.1](https://github.com/zdharma-continuum/zinit/compare/v3.13.0...v3.13.1) (2024-01-22)
### Bug Fixes
* `plugins` command correctly handles keyword argument ([#626](https://github.com/zdharma-continuum/zinit/issues/626)) ([f26d387](https://github.com/zdharma-continuum/zinit/commit/f26d387e51c9103f2ba7142a8c1a25ba1d62e065))
# [3.13.0](https://github.com/zdharma-continuum/zinit/compare/v3.12.1...v3.13.0) (2024-01-18)
### Bug Fixes
* **ci:** remove duplicate gh-r zunit job ([#623](https://github.com/zdharma-continuum/zinit/issues/623)) ([70cefc0](https://github.com/zdharma-continuum/zinit/commit/70cefc086a8b2277476e7f4fa3e00e0f7d4fd4cf))
* debug logging logic and format ([#592](https://github.com/zdharma-continuum/zinit/issues/592)) ([3c7e5be](https://github.com/zdharma-continuum/zinit/commit/3c7e5be07d79b8f1a7fbd5dfd150a09a6309e461))
* handle zinit --help ([#597](https://github.com/zdharma-continuum/zinit/issues/597)) ([8cf9104](https://github.com/zdharma-continuum/zinit/commit/8cf9104ac08da3f7f108a32e0a3b117e22681d46))
* link ice check in .zinit-download-snippet function ([#608](https://github.com/zdharma-continuum/zinit/issues/608)) ([358ef03](https://github.com/zdharma-continuum/zinit/commit/358ef03785a18e694e94fd4560e0582c4024bcc3))
* pin dua gh-r test to v2.20.3 ([#605](https://github.com/zdharma-continuum/zinit/issues/605)) ([0ba778a](https://github.com/zdharma-continuum/zinit/commit/0ba778ac734e33c960fe08bbd56a351b1b86dcd4))
* silence unzip command in ziextract ([#614](https://github.com/zdharma-continuum/zinit/issues/614)) ([71764bf](https://github.com/zdharma-continuum/zinit/commit/71764bf2caa553f52435ed374bb48b74b0a8ad96))
* tar permissions when `ziextract` ran as root user ([#557](https://github.com/zdharma-continuum/zinit/issues/557)) ([e2d477c](https://github.com/zdharma-continuum/zinit/commit/e2d477cde4e87d13ebc6b99e7f95022f75ca075e))
* update labeler config to v5 ([#604](https://github.com/zdharma-continuum/zinit/issues/604)) ([794723c](https://github.com/zdharma-continuum/zinit/commit/794723cc4829e0f9293fc441100913ac7f02566a))
### Features
* configure, make, cmake, and build ices ([#613](https://github.com/zdharma-continuum/zinit/issues/613)) ([#616](https://github.com/zdharma-continuum/zinit/issues/616)) ([22e66db](https://github.com/zdharma-continuum/zinit/commit/22e66db478716005d6fec52cd412fad3fc94a9a2))
* **delete:** fix unsetting plugin state & add `--debug` / `--quiet` flags ([#622](https://github.com/zdharma-continuum/zinit/issues/622)) ([3f4b685](https://github.com/zdharma-continuum/zinit/commit/3f4b68562265e6b06f55124e34fab0fe58c53adf))
* remove zpextract and use ziextract ([#611](https://github.com/zdharma-continuum/zinit/issues/611)) ([2ccac85](https://github.com/zdharma-continuum/zinit/commit/2ccac85e376965a6e6d9fe1dc3f1470b706e9fac))
## [3.12.1](https://github.com/zdharma-continuum/zinit/compare/v3.12.0...v3.12.1) (2023-11-20)
### Bug Fixes
* container zshelldoc install ([#591](https://github.com/zdharma-continuum/zinit/issues/591)) ([8170753](https://github.com/zdharma-continuum/zinit/commit/8170753a5d21f2e54ba30901cdb0afb6399a7b51))
* from'gh-r' skips compile by default ([#590](https://github.com/zdharma-continuum/zinit/issues/590)) ([1f52eee](https://github.com/zdharma-continuum/zinit/commit/1f52eee1b1ef4a76b779d2017f2e7d2151516544))
* respect delete flags after positional arguments ([#587](https://github.com/zdharma-continuum/zinit/issues/587)) ([e18f9a7](https://github.com/zdharma-continuum/zinit/commit/e18f9a7da273fa44079b16a90e89df76664fcbee))
* set home dir to test env in gh-r tests ([#582](https://github.com/zdharma-continuum/zinit/issues/582)) ([9b33288](https://github.com/zdharma-continuum/zinit/commit/9b33288b4aa88a1d41786eacfe31eb966b6c0455))
* use $MACHTYPE instead of arch command ([#588](https://github.com/zdharma-continuum/zinit/issues/588)) ([bcf70e8](https://github.com/zdharma-continuum/zinit/commit/bcf70e8268dd09737d262919dcba0ff3301a705d))
# [3.12.0](https://github.com/zdharma-continuum/zinit/compare/v3.11.0...v3.12.0) (2023-08-30)
### Bug Fixes
* build container for tagged releases ([f933dc0](https://github.com/zdharma-continuum/zinit/commit/f933dc028e9968ed434c21775c2bfc85a722ee04))
* gh-r linux regex & gh-r zunit tests ([#564](https://github.com/zdharma-continuum/zinit/issues/564)) ([207ab9f](https://github.com/zdharma-continuum/zinit/commit/207ab9f281214bc07da82e7e542126745bf878dd))
* gh-r zunit tests ([#561](https://github.com/zdharma-continuum/zinit/issues/561)) ([97b087e](https://github.com/zdharma-continuum/zinit/commit/97b087e68ae0c87cc31bcc9172cedf1cf5fcab68))
* Ignore .yaml and .py files when installing completions ([#528](https://github.com/zdharma-continuum/zinit/issues/528)) ([113cfc4](https://github.com/zdharma-continuum/zinit/commit/113cfc47fb6ec1ed753222b7ba4542ef48ca2fde))
* jq has moved from stedolan/jq to jqlang/jq ([#530](https://github.com/zdharma-continuum/zinit/issues/530)) ([de85908](https://github.com/zdharma-continuum/zinit/commit/de85908f8d0b89ff6327adfa285ca5a0c4302f2d))
* math expression in plugins command ([#559](https://github.com/zdharma-continuum/zinit/issues/559)) ([68a6b42](https://github.com/zdharma-continuum/zinit/commit/68a6b42caf224b2ca2c172d58daf9faf5c86beb9))
* pin fclones version to v0.31.0 ([497d519](https://github.com/zdharma-continuum/zinit/commit/497d519d99c3d3cdb8e71dfdf4583cadef9220a0))
* quote parens so that they aren't used as globs ([#549](https://github.com/zdharma-continuum/zinit/issues/549)) ([1375adf](https://github.com/zdharma-continuum/zinit/commit/1375adf8f8edadbdcfc18445d852c7f08e723887))
* self-update check for updates ([#562](https://github.com/zdharma-continuum/zinit/issues/562)) ([b456a2d](https://github.com/zdharma-continuum/zinit/commit/b456a2dba65673f4cf5a9a8c2bc16d7d0dcb3ace))
* update gomi repo owner ([#568](https://github.com/zdharma-continuum/zinit/issues/568)) ([19ca2dc](https://github.com/zdharma-continuum/zinit/commit/19ca2dc361f9995a3e6a8a8aed0ade435168cd3d))
### Features
* build container with zsh 5.9 ([#525](https://github.com/zdharma-continuum/zinit/issues/525)) ([238e843](https://github.com/zdharma-continuum/zinit/commit/238e843d60de27b8f3deaf2d0b5e6657b293c9eb))
# [3.11.0](https://github.com/zdharma-continuum/zinit/compare/v3.10.0...v3.11.0) (2023-05-04)
### Bug Fixes
* add `.gitignore` with '*' pattern in a plugins `._zinit/` directory ([#397](https://github.com/zdharma-continuum/zinit/issues/397)) ([fccb508](https://github.com/zdharma-continuum/zinit/commit/fccb5080ab4b1df83f01906082eea444f218776f)), closes [#395](https://github.com/zdharma-continuum/zinit/issues/395)
* broken update command ([336ca85](https://github.com/zdharma-continuum/zinit/commit/336ca85ade5d4c5c99bd903610baf9961753192b))
* cleanup style, naming, and completion ([6c82d67](https://github.com/zdharma-continuum/zinit/commit/6c82d6788dec6a60c4c217d03c45c327bc0e59a1))
* compile and completion log messages ([c4446da](https://github.com/zdharma-continuum/zinit/commit/c4446da57e5375f4a89ea94e1e8c04eacfc4e494))
* csearch ignores lua files ([4d1840b](https://github.com/zdharma-continuum/zinit/commit/4d1840b883e86cc46df2050c01bd0731e29023aa))
* makefile clean target less verbose ([3396f5e](https://github.com/zdharma-continuum/zinit/commit/3396f5e3aa1fb81d128d4f34b9ff868011d68981))
* pin git-mkver gh-r test to v.1.2.2 ([a05cc1a](https://github.com/zdharma-continuum/zinit/commit/a05cc1ab59db5b82c5a0f7ee0b6bbef84f0e8b0e))
* pin git-mkver unit test to v1.2.2 ([08f02e0](https://github.com/zdharma-continuum/zinit/commit/08f02e00d0fbc86b10d44d18f5b774c9c00806cc))
* regenerate docs ([e0177e2](https://github.com/zdharma-continuum/zinit/commit/e0177e20382d8336d55bc2637a6f2c515d25ce19))
### Features
* expand gh-r zunit tests ([c323116](https://github.com/zdharma-continuum/zinit/commit/c3231164836c8ca3ca9ebded8d95c31c0a186567))
* refactor debug commands ([930b25e](https://github.com/zdharma-continuum/zinit/commit/930b25ee3c6cc66931eda0030c422fddd69ef9c4))
* refactor ls, list, and loaded commands ([a865907](https://github.com/zdharma-continuum/zinit/commit/a86590762ac2bb5244db5d3cd7d99d32a9dc11fe))
# [3.10.0](https://github.com/zdharma-continuum/zinit/compare/v3.9.0...v3.10.0) (2023-04-02)
### Bug Fixes
* absolute path support in the symbol browser ([d29a8ba](https://github.com/zdharma-continuum/zinit/commit/d29a8ba2b757b936663c16d12e46d3638f44027a))
* assign to functions hash to make %x work ([bd65a01](https://github.com/zdharma-continuum/zinit/commit/bd65a017345ac891b6b14eb5feb4182bc9c74ace))
* broken symbolic link after `creinstall .` ([da0d6b7](https://github.com/zdharma-continuum/zinit/commit/da0d6b712c6466d11165ac9e27a6cd7de856e537))
* bump node version in release workflow ([938f483](https://github.com/zdharma-continuum/zinit/commit/938f48375b20545078b63d6c1dba0a905599afe4))
* change prefix `~zi::` to `__zi::` ([0e45493](https://github.com/zdharma-continuum/zinit/commit/0e45493e36ff350c79c164895bd4718103e2cf7a))
* container build & shell make targets ([a72fb83](https://github.com/zdharma-continuum/zinit/commit/a72fb83f0999a7fa4a26c6e1bb71d6cab3858b4f))
* container build & shell make targets ([14b2cda](https://github.com/zdharma-continuum/zinit/commit/14b2cda0397c343b1bfdc041cba7c4ab216e3803))
* container build & shell make targets ([370808d](https://github.com/zdharma-continuum/zinit/commit/370808dd5186f4b9c8a214e7ef6f4350df243b5b))
* container build & shell make targets ([47bd74f](https://github.com/zdharma-continuum/zinit/commit/47bd74f8a7c74761e9b03943d3c40fc523df585f))
* container build & shell make targets ([f8eb967](https://github.com/zdharma-continuum/zinit/commit/f8eb967b0e98f135b43cb5065aceb8a4f058aa09))
* container build & shell make targets ([3af321e](https://github.com/zdharma-continuum/zinit/commit/3af321e8e4975a07634df08acda383e4cf53e99c))
* do not run `make docs` ([3802893](https://github.com/zdharma-continuum/zinit/commit/3802893c74988fc03bad086601c905a1046a9fc1))
* failing zunit tests & bootstrap script ([d618467](https://github.com/zdharma-continuum/zinit/commit/d618467ff090a6dbfb327ca0a29141d0c9312b24))
* file modelines ([75bb735](https://github.com/zdharma-continuum/zinit/commit/75bb73547ed24ab6d25e1aed03684caebba39f5e))
* gh-r & bpick ice log format and content ([ad88a89](https://github.com/zdharma-continuum/zinit/commit/ad88a890ad25505acb764f9551ee00d5264daa9a))
* gh-r parsing logic for arm64 & logging style ([7e48651](https://github.com/zdharma-continuum/zinit/commit/7e486519d7aad48a8b6009ae5075f0efec2409f9))
* gh-r pattern for 64bit linux-gnu systems ([b5a31c0](https://github.com/zdharma-continuum/zinit/commit/b5a31c07f2bd2d823ce9e99b98228ec68db523bd))
* lsd repo owner changed to lsd-rs organization ([#489](https://github.com/zdharma-continuum/zinit/issues/489)) ([824d9d3](https://github.com/zdharma-continuum/zinit/commit/824d9d36177dac00a81333205e2b3dfbc35cb758))
* make gh-r release search case-insensitive ([3eb75b7](https://github.com/zdharma-continuum/zinit/commit/3eb75b7ee9db4dd01455811cf4ca4539dd07246b))
* make target docker cmd flags ([dd04896](https://github.com/zdharma-continuum/zinit/commit/dd048964491b9a63f4622b591b9a227d5e981408))
* pin `ggsrun` version in gh-r z-unit test ([9f67798](https://github.com/zdharma-continuum/zinit/commit/9f677989e8386469bc2d5dcb0d2cb5d62d489e34))
* the starship example does not work properly ([4933b62](https://github.com/zdharma-continuum/zinit/commit/4933b62f400a1b6b29b82a9ff233911b336a33c5))
* update pygmentize flags in glance subcommand ([#488](https://github.com/zdharma-continuum/zinit/issues/488)) ([b773763](https://github.com/zdharma-continuum/zinit/commit/b773763bdc37d414a5d954ccb00877374177f0ec))
* use correct return code in zinit-confirm ([d467738](https://github.com/zdharma-continuum/zinit/commit/d467738c1b1c834e938b4b4bb6e83cab5bfdc429))
* vim modelines & zsdoc pdf rendering ([2b460a7](https://github.com/zdharma-continuum/zinit/commit/2b460a74f236178cd8d06b55069049381d79256e))
### Features
* delete subcommand refactor ([9eee215](https://github.com/zdharma-continuum/zinit/commit/9eee215e3f8ee7d8404e4e54f8ef57a57a21fde2)), closes [#57](https://github.com/zdharma-continuum/zinit/issues/57) [#239](https://github.com/zdharma-continuum/zinit/issues/239)
* zinit completion improvements ([b8d12e5](https://github.com/zdharma-continuum/zinit/commit/b8d12e555d4cadff7769ef67c5d4c0d403f0b11e))
### Reverts
* "Merge branch 'refactor/zinit-function-names' into main" ([515688b](https://github.com/zdharma-continuum/zinit/commit/515688bc976e793422d21ba9debfdd1a982c611e))
# [3.9.0](https://github.com/zdharma-continuum/zinit/compare/v3.8.0...v3.9.0) (2022-12-17)
### Bug Fixes
* remove broken gh-r zunit test for "warp" ([#430](https://github.com/zdharma-continuum/zinit/issues/430)) ([64fa4ae](https://github.com/zdharma-continuum/zinit/commit/64fa4aef3ae517afe5444b24df9603e9d1a77a55))
### Features
* add `completions` ice ([#417](https://github.com/zdharma-continuum/zinit/issues/417)) ([59975d7](https://github.com/zdharma-continuum/zinit/commit/59975d70d7101651b0bb01f4e22c23db0dae8133))
* display version via `version` sub command ([bfb01e6](https://github.com/zdharma-continuum/zinit/commit/bfb01e65d7b9a98c643f3ee0a92f2df06372f52e))
### Performance Improvements
* reduce scheduler task check to 10 second interval ([#429](https://github.com/zdharma-continuum/zinit/issues/429)) ([1681ce4](https://github.com/zdharma-continuum/zinit/commit/1681ce40ebf98e5bf48b78ac5d6c060c1ecada99))
### Reverts
* "perf: reduce scheduler task check to 10 second interval ([#429](https://github.com/zdharma-continuum/zinit/issues/429))" ([#432](https://github.com/zdharma-continuum/zinit/issues/432)) ([cfd3261](https://github.com/zdharma-continuum/zinit/commit/cfd32618921ce0626a6deadc794da962750a845d))
# [3.8.0](https://github.com/zdharma-continuum/zinit/compare/v3.7.0...v3.8.0) (2022-11-07)
### Bug Fixes
* account for systems where musl is present ([#269](https://github.com/zdharma-continuum/zinit/issues/269)) ([8620574](https://github.com/zdharma-continuum/zinit/commit/8620574a5533695525260fd88df8d249c701217f))
* alist repository for gh-r test ([#305](https://github.com/zdharma-continuum/zinit/issues/305)) ([fb3c082](https://github.com/zdharma-continuum/zinit/commit/fb3c082551ee9f48676c3183d5a4e9e842d3d874))
* allow zinit to be run from non-interactive scripts ([#227](https://github.com/zdharma-continuum/zinit/issues/227)) ([c3d1bb5](https://github.com/zdharma-continuum/zinit/commit/c3d1bb586c77a98566c552358fd9aee084e30da8)), closes [#199](https://github.com/zdharma-continuum/zinit/issues/199)
* broken yaml syntax in issue template ([#355](https://github.com/zdharma-continuum/zinit/issues/355)) ([f729e06](https://github.com/zdharma-continuum/zinit/commit/f729e065db88a5cd0daa8a6f2bd2f8ee0439545a))
* calico gh-r zunit test ([#356](https://github.com/zdharma-continuum/zinit/issues/356)) ([56fb9e0](https://github.com/zdharma-continuum/zinit/commit/56fb9e0b1df21de809a2efc935882b49e9161618))
* change ctags symbols browser key binding from `ctrl-k` to `alt-Q` ([#387](https://github.com/zdharma-continuum/zinit/issues/387)) ([7f6dc7d](https://github.com/zdharma-continuum/zinit/commit/7f6dc7da6c824b30c0e8e30ae0ecbda5be118e68)), closes [#386](https://github.com/zdharma-continuum/zinit/issues/386)
* Do not try to escape exclamation marks ([#399](https://github.com/zdharma-continuum/zinit/issues/399)) ([0e55b2e](https://github.com/zdharma-continuum/zinit/commit/0e55b2ea673915c462af752ee7d46fff55e6f436))
* docs workflow should fail if out-of-date ([#278](https://github.com/zdharma-continuum/zinit/issues/278)) ([07cde66](https://github.com/zdharma-continuum/zinit/commit/07cde660081c91382ce73b60485839710154c7c6))
* Don't error if $OPTS is not yet defined in .zinit-compinit call ([44765e0](https://github.com/zdharma-continuum/zinit/commit/44765e0bcb8d3f1ee3eb55286e33ad17b8c72a5e))
* filter by runtime detected CPU before compiled CPU ([#304](https://github.com/zdharma-continuum/zinit/issues/304)) ([a4dc13f](https://github.com/zdharma-continuum/zinit/commit/a4dc13f66a65c4fa52953104c13e44a7d7c0a945)), closes [#287](https://github.com/zdharma-continuum/zinit/issues/287)
* gh-r & plugin zunit tests ([dd12fce](https://github.com/zdharma-continuum/zinit/commit/dd12fce3f49db284de7cf18a03ef891cc46bc7cc))
* gh-r filters i686 (32 bit) for x86_64 ([#226](https://github.com/zdharma-continuum/zinit/issues/226)) ([57f0d82](https://github.com/zdharma-continuum/zinit/commit/57f0d82118ed626f04d4b9b8b26de48c9d7e0956)), closes [#225](https://github.com/zdharma-continuum/zinit/issues/225)
* gh-r logic ignores [36]86 assets ([#235](https://github.com/zdharma-continuum/zinit/issues/235)) ([d60638f](https://github.com/zdharma-continuum/zinit/commit/d60638f2217875056a061b3411c4bcc678dce5f6)), closes [#225](https://github.com/zdharma-continuum/zinit/issues/225) [#246](https://github.com/zdharma-continuum/zinit/issues/246) [#247](https://github.com/zdharma-continuum/zinit/issues/247)
* gh-r removes linux32 assets on 64 bit OS ([1864c0b](https://github.com/zdharma-continuum/zinit/commit/1864c0be09faa0e4d9a7c549cafed7d296d7517e))
* gh-r retrieves release data GH REST API ([#373](https://github.com/zdharma-continuum/zinit/issues/373)) ([4a2a120](https://github.com/zdharma-continuum/zinit/commit/4a2a120b341793b1abaef5f12fbb4808277d8570)), closes [#374](https://github.com/zdharma-continuum/zinit/issues/374)
* modify regex in gh-r for assets to not consider for selection ([#244](https://github.com/zdharma-continuum/zinit/issues/244)) ([6ef8439](https://github.com/zdharma-continuum/zinit/commit/6ef84398b2c92073d88f440dfbfd554cb8e75343))
* more cleaning up urls ([672ae51](https://github.com/zdharma-continuum/zinit/commit/672ae514142b433708ea10486556fe3f0ba54e3e)), closes [#47](https://github.com/zdharma-continuum/zinit/issues/47)
* names of ctag Make target deps ([#407](https://github.com/zdharma-continuum/zinit/issues/407)) ([9987d5c](https://github.com/zdharma-continuum/zinit/commit/9987d5c781d4a95698ed649dc59b11c34006b1c1))
* package are broken again ([24f10f6](https://github.com/zdharma-continuum/zinit/commit/24f10f6367cbab6039bd0c1ca07dd9449bbc3557))
* permissions for PR labeler GH action workflow ([#236](https://github.com/zdharma-continuum/zinit/issues/236)) ([8a0d567](https://github.com/zdharma-continuum/zinit/commit/8a0d5678d1ee0eeed91d2c3a094578a2cd39ba04))
* read without -r is generally bad. ([00c70a4](https://github.com/zdharma-continuum/zinit/commit/00c70a434d50a1591bcdc73185150b2fdce96c77))
* remove curl option "--tcp-fastopen" which is not always available ([#299](https://github.com/zdharma-continuum/zinit/issues/299)) ([308c9d4](https://github.com/zdharma-continuum/zinit/commit/308c9d4cd82f3e41d2ae21ff31fba0dc4a7c6cb5))
* remove macOS 10.5 & 11 from test matrix ([c613193](https://github.com/zdharma-continuum/zinit/commit/c61319378df5b0deae68fc467b9a2449fcf67336))
* remove use less line ([4f87076](https://github.com/zdharma-continuum/zinit/commit/4f870766011d36c871d8afd07afe56733c8de76d))
* rename `docs` to `doc` to match doc dir ([#212](https://github.com/zdharma-continuum/zinit/issues/212)) ([3a7dc95](https://github.com/zdharma-continuum/zinit/commit/3a7dc95f02340fb56693ca0f304e31be8c8a9652))
* rm linux32 assets in aarch64/arm64 gh-r regex ([#414](https://github.com/zdharma-continuum/zinit/issues/414)) ([529aa20](https://github.com/zdharma-continuum/zinit/commit/529aa20f42a249f609b9e8248d6fd00d609a35ce))
* syntax error when checking for `realpath` command ([#259](https://github.com/zdharma-continuum/zinit/issues/259)) ([05559eb](https://github.com/zdharma-continuum/zinit/commit/05559ebdbcda77622daaf3935d20fdf9b9c09c6c)), closes [#257](https://github.com/zdharma-continuum/zinit/issues/257)
* trigger for PR labeler GH action workflow ([#237](https://github.com/zdharma-continuum/zinit/issues/237)) ([49af866](https://github.com/zdharma-continuum/zinit/commit/49af86688bc8c5882744a679f9c0094e2f4c7fa6))
* typo & triggers in documentation workflow ([#308](https://github.com/zdharma-continuum/zinit/issues/308)) ([161d7c1](https://github.com/zdharma-continuum/zinit/commit/161d7c1ee1fc2bbb43442cd90b48e502bf62603f))
* unmatched "(" in windows gh-r patterns ([#280](https://github.com/zdharma-continuum/zinit/issues/280)) ([1f4ba5a](https://github.com/zdharma-continuum/zinit/commit/1f4ba5ae0ccf928d1914dc3a11d00393e0fd94a8))
* update `zdharma` to `zdharma-continuum` ([66b1700](https://github.com/zdharma-continuum/zinit/commit/66b17007523321f9afee91dbe75b487de5db4fec))
* update docs for new jq-check ([6207427](https://github.com/zdharma-continuum/zinit/commit/62074272563f88a32a701f56f914297930a9da19))
* use [*] inside arbitrary strings. ([73a8c92](https://github.com/zdharma-continuum/zinit/commit/73a8c92d43f57bca514e44b9fed14e941168c61f))
* workflow pkg mgmt due to base OS changes ([195f72d](https://github.com/zdharma-continuum/zinit/commit/195f72d54b80051fc71d1f73909f5dabe6745649))
* ziextract execs discovery regex ([#410](https://github.com/zdharma-continuum/zinit/issues/410)) ([105b38a](https://github.com/zdharma-continuum/zinit/commit/105b38a195e2a67eaba9d7a69bcef7738c57d12d))
* zunit install in GH workflow ([#412](https://github.com/zdharma-continuum/zinit/issues/412)) ([f4787dc](https://github.com/zdharma-continuum/zinit/commit/f4787dcac803ed9055c4032c516dba66737beebf))
### Features
* ability to set program for `zinit ls` to use ([#221](https://github.com/zdharma-continuum/zinit/issues/221)) ([bad7af3](https://github.com/zdharma-continuum/zinit/commit/bad7af3ae2d8aab18feb11a0251987fe3c08c31b)), closes [#170](https://github.com/zdharma-continuum/zinit/issues/170)
* add `-a` (actual time) to `zinit times` cmd ([#223](https://github.com/zdharma-continuum/zinit/issues/223)) ([450d3c1](https://github.com/zdharma-continuum/zinit/commit/450d3c10a8f6728ee8c76bfb99f777658b8d3f35))
* add `krew` and `prebuilt-ripgrep` gh-r zunit tests ([#267](https://github.com/zdharma-continuum/zinit/issues/267)) ([f25b4ae](https://github.com/zdharma-continuum/zinit/commit/f25b4ae2b9951bf0d1306a17ef512a1868211b78))
* add compile vim from source zunit test ([#232](https://github.com/zdharma-continuum/zinit/issues/232)) ([126528c](https://github.com/zdharma-continuum/zinit/commit/126528ccd50e98c0e71f06971ae16aceb571fb97))
* add configure"" ice ([#334](https://github.com/zdharma-continuum/zinit/issues/334)) ([40a46c6](https://github.com/zdharma-continuum/zinit/commit/40a46c6d2250af7e01d91b2f8ec3e01cf392c3d1))
* add GH action to remove old workflow logs ([#248](https://github.com/zdharma-continuum/zinit/issues/248)) ([6647bdc](https://github.com/zdharma-continuum/zinit/commit/6647bdc31c5b82378195ce71055099a7b36734a1))
* add PR labeler to show what parts of Zinit are changed ([#211](https://github.com/zdharma-continuum/zinit/issues/211)) ([42e83d7](https://github.com/zdharma-continuum/zinit/commit/42e83d7f99254c16e408f52848b914f7aa264372))
* add releases via semantic-release ([73542b4](https://github.com/zdharma-continuum/zinit/commit/73542b490981e43adca4a09b64c327fe811d01e1))
* add releases via semantic-release ([#415](https://github.com/zdharma-continuum/zinit/issues/415)) ([cfa2f0e](https://github.com/zdharma-continuum/zinit/commit/cfa2f0ebcd674706d5cb91533cf362f6f4ddd7ee))
* expand linted file types to markdown and shell ([96fe03f](https://github.com/zdharma-continuum/zinit/commit/96fe03f85baf8eae33270a09a5ca82f108f6cc25))
* **git-process-output:** simplify progress-bar ([#204](https://github.com/zdharma-continuum/zinit/issues/204)) ([c888917](https://github.com/zdharma-continuum/zinit/commit/c888917edbafa3772870ad1f320da7a5f169cc6f))
* update output messaging to be more informative ([047320a](https://github.com/zdharma-continuum/zinit/commit/047320a9234be4de8299ff4796e28e2363e77984))
# [v3.7.0](https://github.com/zdharma-continuum/zinit/compare/v3.1...v3.7.0)

View file

@ -1,101 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for
everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity
and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion,
or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take
appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for
moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing
the community in public spaces. Examples of representing our community include using an official e-mail address, posting
via an official social media account, or acting as an appointed representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible
for enforcement at . All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem
in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the
community.
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation
and an explanation of why the behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of actions.
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including
unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding
interactions in community spaces as well as external channels like social media. Violating these terms may lead to a
temporary or permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified
period of time. No public or private interaction with the people involved, including unsolicited interaction with those
enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate
behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq.
Translations are available at https://www.contributor-covenant.org/translations.
[homepage]: https://www.contributor-covenant.org

441
DONATIONS.md Normal file
View file

@ -0,0 +1,441 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [2018-08-14, received $30](#2018-08-14-received-30)
- [2018-08-03, received $8](#2018-08-03-received-8)
- [2018-08-02, received $3 from Patreon](#2018-08-02-received-3-from-patreon)
- [2018-07-31, received $7](#2018-07-31-received-7)
- [2018-07-28, received $2](#2018-07-28-received-2)
- [2018-07-25, received $3](#2018-07-25-received-3)
- [2018-07-20, received $3](#2018-07-20-received-3)
- [2018-06-17, received ~$155 (200 CAD)](#2018-06-17-received-155-200-cad)
- [2018-06-10, received $10](#2018-06-10-received-10)
- [2018-05-25, received $50](#2018-05-25-received-50)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Below are reports about what is being done with donations, i.e. which commits
are created thanks to them, which new features are added, etc. From the money
I receive I buy myself coffee and organize the time to work on the requested
features, sometimes many days in a row.
## 2018-08-14, received $30
* **Project**: **[Zplugin](https://github.com/zdharma/zplugin)**
* **Goal**: Create a binary Zsh module with one Zplugin optimization and optionally some
other features.
* **Status**: The job is done.
Thanks to this donation I have finally started to code **[binary Zplugin module](
https://github.com/zdharma/zplugin#quick-start-module-only)**, which is a big step onward
in evolution of Zplugin. I've implemented and published the module with 3 complete
features: 1) `load` optimization, 2) autocompilation of scripts, 3) profiling of script
load times.
Commit list:
```
2018-08-22 7b96fad doc: mod-install.sh
2018-08-22 ba1ba64 module: Update zpmod usage text
2018-08-22 b0d72e8 zplugin,*autoload: `module' command, manages new zdharma/zplugin module
2018-08-22 706bbb3 Update Zsh source files to latest
2018-08-20 b77426f module: source-study builds report with milliseconds without fractions
2018-08-20 c3cc09b module: Updated zpmod_usage, i.a. with `source-study' sub-command
2018-08-20 6190295 module: Go back to subcommand-interface to `zpmod'; simple option parser
2018-08-20 881005f module: Report on sourcing times is shown on `zpmod -S`. Done generation
2018-08-19 e5d046a module: Correct conditions on zwc file vs. script file (after stats)
2018-08-19 1282c21 module: Duration of sourcing a file is measured and stored into a hash
2018-08-18 e080153 module: Overload both `source' and `.' builtins
2018-08-18 580efb8 module: Invoke bin_zcompile with -U option (i.e. no alias expansion)
2018-08-18 b7d9836 module: Custom `source' ensures script is compiled, compiles if not
2018-08-18 1e75a47 module: Code cleanup, vim folding
2018-08-18 a4a02f3 module: Finally working `source'/`.' overload (used options translating)
2018-08-16 99bba56 module: zpmod_usage gained content
2018-08-16 04703cd module: Add the main builtin zpmod with report-append which is working
2018-08-16 cd6dc19 module: my_ztrdup_glen, zp_unmetafy_zalloc
2018-08-16 6d44e36 module: Cleanup, `source' overload after patron leoj3n restarted module
```
## 2018-08-03, received $8
* **Project**: **[zdharma/history-search-multi-word](https://github.com/zdharma/history-search-multi-word)**
* **Goal**: Allow calling `zle reset-prompt` (Zshell feature).
* **Status**: The job is done.
A user wanted to be able to call `reset-prompt` Zshell widget without disturbing my project
`history-search-multi-word`. I've implemented the necessary changes to HSMW.
Commit list:
```
2018-08-04 9745d3d hsmw: reset-prompt-protect zstyle allow users to run zle reset-prompt
2018-08-04 ce48a53 hsmw: More typo-like lackings of % substitution
2018-08-04 7e2d79b hsmw: A somewhat typo, missing % substitution
```
## 2018-08-02, received $3 from Patreon
* **Project**: **[zdharma/fast-syntax-highlighting](https://github.com/zdharma/fast-syntax-highlighting)**
* **Goal**: No goal set up.
* **Status**: Bug-fixing work.
I did bug-fixing run on `fast-syntax-highlighting`, spotted many small and sometimes important things to
improve. Did one bigger thing added global-aliases functionality.
Commit list:
```
2018-08-02 1e854f5 -autoload.ch: Don't check existence for arguments that are variables
2018-08-02 14cdc5e *-string-*: Support highlighter cooperation in presence of $PREBUFFER
2018-08-02 2d8f0e4 *-highlight: Correctly highlight $VAR, $~VAR, ${+VAR}, etc. in strings
2018-08-02 e3032d9 *-highlight: ${#PREBUFFER} -> __PBUFLEN, equal performance
2018-08-02 f0a7121 *-highlight: Make case conditions and brackets highlighter compatible
2018-08-02 781f68e *-highlight: Recognize more case-item-end tokens
2018-08-02 206c122 *-highlight: Remove unused 4th __arg_type
2018-08-02 c6da477 *-string-*: Handle 'abc\' no slash-quoting here. Full quoting support
2018-08-02 52e0176 *-string-*: Fix bug, third level was getting wrong style
2018-08-02 5edbfae -git.ch: Support "--message=..." syntax (commit)
2018-08-02 669d4b7 -git.ch: Handle "--" argument (stops options)
2018-08-02 4fae1f2 -make.ch: Handle make's -f option
2018-08-02 3fd32fe -make.ch: Handle make's -C option
2018-08-02 31751f5 -make.ch: Recognize options that obtain argument
2018-08-02 e480f18 -make.ch: Fix reply-var clash, gained consistency
2018-08-02 0e8bc1e Updated README.md
2018-08-02 eee0034 images: global-alias.png
2018-08-02 00b41ef *-highlight,themes,fast-theme: Support for global aliases #41
```
## 2018-07-31, received $7
* **Project**: **[zdharma/fast-syntax-highlighting](https://github.com/zdharma/fast-syntax-highlighting)**
* **Goal**: Implement ideal brackets highlighting.
* **Status**: The job is done.
When a source code is edited e.g. in `Notepad++` or some IDE, then most often brackets are somehow matched to
each other, so that the programmer can detect mistakes. `Fast-syntax-highlighting` too gained that feature. It
was done in such a way that FSH cannot make any mistake, colors will perfectly match brackets to each other.
Commit list:
```
2018-07-31 2889860 *-highlight: Correct place to initialize $_FAST_COMPLEX_BRACKETS
2018-07-31 2bde2a9 Performance status -15/8/8
2018-07-31 5078261 *-highlight,README: Brackets highlighter active by default
2018-07-31 2ee3073 *-highlight,*string-*: Brackets in [[..]], ((..)), etc. handled normally
2018-07-31 776b12d plugin.zsh: $_ZSH_HIGHLIGHT_MAIN_CACHE -> $_FAST_MAIN_CACHE
2018-07-30 2867712 plugin.zsh: Fix array parameter created without declaring #43
2018-07-30 cbe5fc8 Updated README.md
2018-07-30 2bd3291 images: brackets.gif
2018-07-30 ef23a96 *-string-*: Bug-fix, correctly use theme styles
2018-07-30 9046f82 plugin.zsh: Attach the new brackets highlighter; F_H[use_brackets]=1
2018-07-30 b33a5fd fast-theme: Support 4 new styles (for brackets)
2018-07-30 a03f004 themes: Add 4 new styles (brackets)
2018-07-30 2448cdc *-string-*: Additional highlight of bracket under cursor; more styles
2018-07-30 5e1795e *-string-*: Highlighter for brackets, handles all quotings; detached
```
## 2018-07-28, received $2
* **Project**: **[zdharma/fast-syntax-highlighting](https://github.com/zdharma/fast-syntax-highlighting)**
* **Goal**: Distinguish file and directory when highlighting
* **Status**: The job is done.
A user requested that when `fast-syntax-highlighting` colorizes the command line it should use different
styles (e.g. colors) for token that's a *file* and that's a *directory*. It was a reasonable idea and I've
implemented it.
Commit list:
```
2018-07-28 7f48e04 themes: Extend all themes with new style `path-to-dir'
2018-07-28 c7c6a91 fast-theme: Support for new style `path-to-dir'
2018-07-28 264676c *-highlight: Differentiate path and to-dir path. New style: path-to-dir
```
## 2018-07-25, received $3
* **Project**: **[zdharma/zshelldoc](https://github.com/zdharma/zshelldoc)**
* **Goal**: Implement documenting of used environment variables.
* **Status**: The job is done.
Zshelldoc generates code-documentation like Doxygen or Javadoc, etc. User requested a
new feature: the generated docs should enumerate environment variables used and/or
exported by every function. Everything went fine and this feature has been implemented.
Commit list:
```
2018-07-26 f63ea25 Updated README.md
2018-07-26 3af0cf7 *detect: Get `var' from ${var:-...} and ${...:+${var}} and other subst
2018-07-25 2932510 *adoc: Better language in output document (about exported vars) #5
2018-07-25 f858dd8 *adoc: Include (in the output document) data on env-vars used #5
2018-07-25 80e3763 *adoc: Include data on exports (environment) in the output document #5
2018-07-25 ca576e2 *detect: Detect which env-vars are used, store meta-data in data/ #5
2018-07-25 f369dcc *detect: Function `find-variables' reported "$" as a variable, fixed #5
2018-07-25 e243dab *detect: Function `find-variables' #5
2018-07-25 5b34bb1 *transform: Detect exports done by function/script-body, store #5
```
## 2018-07-20, received $3
* **Project**: **[zdharma/zshelldoc](https://github.com/zdharma/zshelldoc)**
* **Goal**: Implement stripping of leading `#` char from functions' descriptions.
* **Status**: The job is done.
A user didn't like that functions' descriptions in the JavaDoc-like document (generated with Zshelldoc) all
contain a leading `#` character. I've added stripping of this character (it is there in the processed source
code) controlled by a new Zshelldoc option.
Commit list:
```
2018-07-20 172c220 zsd,*adoc,README: Option --scomm to strip "#" from function descriptions
```
## 2018-06-17, received ~$155 (200 CAD)
* **Project**: **[zdharma/fast-syntax-highlighting](https://github.com/zdharma/fast-syntax-highlighting)**
* **Goal**: No goal set up.
* **Status**: Done intense research.
I've created 2 new branches: `Hue-optimization` (33 commits) and `Tidbits-feature` (22 commits). Those were
branches with architectural changes and extraordinary features. The changes yielded to be too slow, and I had
to withdraw the merge. Below are fixing and optimizing commits (i.e. the valuable ones) that I've restored
from the two branches into master.
Commit list:
```
2018-07-21 dab6576 *-highlight: Merge-restore: remove old comments
2018-07-21 637521f *-highlight: Merge-restore: a threshold on # of zle .redisplay calls
2018-07-21 4163d4d *-highlight: Merge-restore: optimize four $__arg[1] = ... cases
2018-07-21 0f01195 *-highlight: Merge-restore: can remove one (Q) dequoting
2018-07-21 39a4ec6 *-highlight: Merge-restore: $v = A* is faster than $v[1] = A, tests:
2018-07-21 99d6b33 *-highlight: Merge-restore: optimize-out ${var:1} Bash syntax
2018-07-21 719c092 *-highlight: Merge-restore: allow $V/cmd, "$V/cmd, "$V/cmd", "${V}/cmd"
2018-07-21 026941d *-highlight: Merge-restore: stack pop in single instruction, not two
2018-07-21 3467e3d *-highlight: Merge-restore: more reasonable redirection-detecting code
2018-07-21 00d25ee *-highlight: Merge-restore: one active_command="$__arg" not needed (?)
2018-07-21 1daa6b3 *-highlight: Merge-restore: simplify ; and \n code short-paths
2018-07-21 55d65be *-highlight: Merge-restore: proc_buf advancement via patterns (not (i))
2018-07-21 cc55546 *-highlight: Merge-restore: pattern matching to replace (i) flag
```
## 2018-06-10, received $10
* **Project**: **[zdharma/fast-syntax-highlighting](https://github.com/zdharma/fast-syntax-highlighting)**
* **Goal**: No goal set up.
* **Status**: Done intense experimenting.
I was working on *chromas* command-specific colorization. I've added `which` and
`printf` colorization, then added asynchronous path checking (needed on slow network
drives), then coded experimental `ZPath` feature for chromas, but it couldn't be optimized
so I had to resign of it.
Commit list:
```
2018-06-12 c4ed1c6 Optimization the same idea as in previous patch, better method
2018-06-12 c36feef Optimization a) don't index large buffer, b) with negative index
2018-06-12 2f03829 Performance status 2298 / 1850
2018-06-12 14f5159 New working feature ZPath. It requires optimization
2018-06-12 e027c40 -which.ch: One of commands can apparently return via stderr (#27)
2018-06-11 5b8004f New chroma `ruby', works like chroma `perl', checks syntax via -ce opts
2018-06-10 ca2e18b *-highlight: Async path checking has now 8-second cache
2018-06-10 e071469 *-highlight: Remove path-exists queue clearing
2018-06-10 5a6684c *-highlight: Support for asynchronous path checking
2018-06-10 1d7d6f5 New chroma: `printf', highlights special sequences like %s, %20s, etc.
2018-06-10 8f59868 -which.ch: Update main comment on purpose of this chroma
2018-06-10 5f4ece2 -which.ch: Added `whatis', it has only 1st line if output used
2018-06-10 e2d173e -which.ch: Uplift: handle `which' called on a function, /usr/bin/which
```
## 2018-05-25, received $50
* **Project**: **[zdharma/fast-syntax-highlighting](https://github.com/zdharma/fast-syntax-highlighting)**
* **Goal**: No goal set up.
* **Status**: New ideas and features.
I was working from May, 25 to June, 9 and came up with key ideas and implemented them. First were *themes*
that were very special because they were using `INI` files instead of some Zsh-script format. Creating themes
for `fast-syntax-highlighting` is thus easy and fun. Then I came up with *chromas*, command-specific
highlighting, which redefine how syntax-highlighting for Zshell works detailed highlighting for e.g. Git
became possible, the user is informed about e.g. a mistake even before running a command. Overall 178 commits
in 16 days.
```
2018-06-09 3f72e6c -git.ch: `revert' works almost like `checkout', attach `revert' there
2018-06-09 b892743 Updated CHROMA_GUIDE.adoc
2018-06-09 f05643d Revert "Revert "Updated CHROMA_GUIDE.md""
2018-06-09 729bf7f Revert "Revert "CHROMA_GUIDE: Remove redundant comments, uplift""
2018-06-09 48a4e0c Revert "CHROMA_GUIDE: Remove redundant comments, uplift"
2018-06-09 55ede0a Revert "Updated CHROMA_GUIDE.md"
2018-06-09 17a28ba New chroma `-docker.ch' that verifies image ID passed to `image rm'
2018-06-09 868812a -make.ch,*-make-targets: Check Makefile exists, use 7 second cache, #24
2018-06-09 73df278 -sh.ch: Attach fish, has -c option, though different syntax, let's try
2018-06-09 3a73b8e Updated CHROMA_GUIDE.md
2018-06-09 29d04c8 CHROMA_GUIDE: Remove redundant comments, uplift
2018-06-09 22ce1d8 -sh.ch,*-highlight: Attach to 2 other shells, Zsh and Bash
2018-06-09 f54e44f New chroma `-sh.ch', colorizes code passed to `sh' with -c option
2018-06-09 f5d2375 CHROMA_GUIDE: Add example code block (rendered broken in mdown)
2018-06-09 08f4b28 CHROMA_GUIDE: Switch to asciidoc (rename)
2018-06-09 4e03609 CHROMA_GUIDE.md
2018-06-09 bbcf2d6 -source.ch: Word "source" should be highlighted as builtin
2018-06-09 6739b8b New chroma `source' to handle . and source builtins
2018-06-09 b961211 gitignore: ignore more paths
2018-06-09 59d5d09 Updated README.md
2018-06-09 f6d4d19 Updated README.md
2018-06-09 eb31324 Update README.md (figlet logo)
2018-06-09 71dcc5f Performance status 298 / 479
2018-06-09 00c5f8f *-highlight: Add comments
2018-06-09 232903c -awk.ch: Highlight `sub' function, not working {, } highlighting
2018-06-09 b5241ba *-highlight: Much better $( ) recursion, would say problems-free, maybe
2018-06-08 6c69437 *-highlight: Larger buffer (110 -> 250) for $( ) matching
2018-06-08 f2b7a96 -awk.ch: Syntax check code passed to awk. Awk is very forgiving, though
2018-06-08 c53d8ba -vim.ch: Pass almost everything to big-loop, check if vim exists
2018-06-08 7fbf7cd chroma: New chroma `vim', shows last opened files under prompt
2018-06-08 06e4570 gitignore: Extend .gitignore
2018-06-08 3184ba1 chroma: All chroma functions end chroma mode on e.g. | and similar
2018-06-08 070077d *-highlight,-example.ch: Rename arg_type -> __arg_type, use it to end
2018-06-08 6c2411e -awk.ch: Use the new theme style `subtle-bg'
2018-06-08 9ec8d63 themes: All themes (remaining 4) to support `subtle-bg' style
2018-06-08 66e848b fast-theme: New theme key `subtle-bg', default & clean.ini support it
2018-06-08 1e794f9 -awk.ch: More keywords highlighted
2018-06-08 f3bbaca -awk.ch: Don't highlight keywords when they only contain proper keyword
2018-06-08 e4d5283 -awk.ch: Fix mistake (indices), was highlighting 1 extra trailing letter
2018-06-08 eebbb19 -awk.ch: Initialize FSH_LIST
2018-06-08 8ec24ca *-highlight: Missing math function for awk
2018-06-08 d8e423a -awk.ch: Highlight more keywords, via more general code
2018-06-07 ee26e66 Commit missing -fast-make-targets
2018-06-07 9d4f2b5 New chroma `-awk.ch', colorizes regex characters and a keyword (print)
2018-06-07 def5133 -example.ch: Add comments
2018-06-07 f31a2d0 New chroma -make.ch, verifies if target is correct
2018-06-07 623b8ce -perl.ch: Use correct keys in FAST_HIGHLIGHT hash
2018-06-07 090f420 themes: Make all themes provide {in,}correct-subtle styles
2018-06-07 2201fb6 New -perl.ch chroma, syntax-checks perl code; 2 new theme entries
2018-06-06 4b9598e *-highlight: Fix bug in math highlight allow variables starting with _
2018-06-06 708afec *-highlight: Fix FAST_BLIST_PATTERNS not expanding path to absolute one
2018-06-06 caef05a -example.ch: Update, fix typos, remove unused code
2018-06-06 3fb192a Updated README.md
2018-06-06 6de0c82 images: git_chroma.png
2018-06-06 2852fdd -grep.ch (new): Special highlighting for grep -grep.ch chroma function
2018-06-06 f216785 -example.ch: Added comments
2018-06-06 4ab5b36 -example.ch: Add comments
2018-06-06 380cd12 -example.ch: Added comments
2018-06-06 c8947cc -example.ch: Add comments
2018-06-06 f2e273e -example.ch: Add comments
2018-06-06 2f3565b plugin.zsh: Fix parse error
2018-06-06 4f1a9bd plugin.zsh: Added $fpath handling, to match what README contains
2018-06-06 cc9adb5 -example.ch: Change and extend comments
2018-06-06 3128fff -git.ch: More intelligent `checkout' highlighting ref is first
2018-06-06 4b6f54b -git.ch: Support for `checkout' subcommand
2018-06-06 1930d37 -example.ch: Added example chroma function
2018-06-05 d79cd85 -git.ch: Add comments
2018-06-05 1473c9e -git.ch: Add comments
2018-06-05 0cb1419 -git.ch: Message passed after -m is checked for the 72 chars boundary
2018-06-05 3f99944 -git.ch: Architectural uplift of git chroma
2018-06-05 e044d13 -git.ch: Single place to add entry to $reply (target: region_highlight)
2018-06-05 3a84364 -git.ch: Handle quoted non-option arguments, also partly quoted: "abc
2018-06-05 d635bf4 -fast-run-git-command, it handles cache automatically, decimates source
2018-06-05 102ea78 -git.ch: Smart handling of `git push', remotes and branches are verified
2018-06-04 be88850 Performance status [+] 39+77=116 / -26+24=-2
2018-06-04 0e033f8 Experimental chroma support, currently active only on command `git'
2018-06-04 43ae221 *-highlight: Emacs mode-line
2018-06-04 938ad29 test: New "-git" parsing option, test results, -git.ch included
2018-06-04 e433fbc fast-theme: Explicitly return 0; added Emacs mode-line
2018-06-04 66e9b3c *-highlight: Detection of $( ) now doesn't go for $(( )) as a candidate
2018-06-04 488a580 chroma: Empty chroma function for `git'
2018-06-04 f54d770 *-highlight: Rename $cur_cmd to $active_command
2018-06-04 3f24e68 *-highlight: Make sudo and always-block compatible with `case' handling
2018-06-02 cd82637 themes: forest.ini to support 3 new `case' styles
2018-06-02 e1e993e themes: safari.ini & zdharma.ini to support 3 new `case' styles
2018-06-02 2e78a02 themes: clean.ini & default.ini to support 3 new `case' styles
2018-06-02 c1c3aab themes: free.ini to support 3 new `case' styles
2018-06-02 70a7e18 fast-theme,*-highlight: 3 new styles for `case' higlighting
2018-06-02 8d90dc2 *-highlight: Support for `case' highlighting
2018-06-02 10d291c *-highlight: Softer state manipulation, less rigid =1 etc. assignments
2018-06-02 6159507 *-highlight: Don't highlight closing ) with style `assign'
2018-06-02 1fc2450 *-highlight: One complex math command optimization, top of the loop
2018-06-02 cc49247 *-highlight: Fix improper state after assignment (command | regular)
2018-06-02 02942b8 Updated README.md
2018-06-02 5e28259 images: eval_cmp.png
2018-06-02 df92fed *-highlight: Fix removal of trailing "/' when recursing in eval
2018-06-02 4f61938 Performance status 46 / 44
2018-06-02 a5ade0e *-highlight: Recursive highlighting of eval string argument
2018-06-02 e91847b *-highlight: Don't recurse when not at main *-process call
2018-06-02 fca8603 *-highlight: Support assignments of arrays when key is taken from array
2018-06-02 5d70f01 *-highlight: Math highlighting recognizes ${+VAR}
2018-06-02 c48eb0d *-highlight: Math colorizing recognizes variables in braces ${HISTISZE}
2018-06-02 53dd85a *-highlight: Allow -- for precommand modifiers command & exec
2018-06-02 d9fe110 *-highlight: Detect globbing also when `##' occurs
2018-06-02 55c923d Performance status 132 / 66
2018-06-02 3bd8f07 themes: safari.ini to have globbing color specifically selected
2018-06-02 2b55260 themes: free.ini to have globbing color specifically selected
2018-06-02 494868e themes: clean.ini to have globbing color specifically selected
2018-06-01 fca6b3d images: herestring.png #9
2018-06-01 f9842c1 themes: forest.ini to use underline instead of bg color #9
2018-06-01 c25c539 themes: Small tune-up of forest & zdharma themes for here-string #9
2018-06-01 988d504 themes: Rudimentary (all same) configuration of here-string tokens #9
2018-06-01 99842d2 fast-theme,*-highlight: Support for here-string, can use bg color #9
2018-06-01 f739c30 Updated README.md
2018-06-01 7fa8451 images: execfd.png execfd_cmp.png
2018-06-01 d7384f1 themes: All themes gained `exec-descriptor=` key, now supported by code
2018-06-01 d66d140 themes: Fix improper effect of s/red/.../ substitution in clean,forest
2018-06-01 f7ee5e2 fast-theme,*-highlight: Support highlighting of {FD} etc. passed to exec
2018-06-01 e5c5534 *-highlight: Proper states for precmd (command,exec) option handling
2018-06-01 647b198 images: New cmdsubst.png
2018-06-01 74bdc4c Updated README.md
2018-06-01 86eb15e images: theme.png
2018-06-01 5169e82 Updated README.md
2018-06-01 1c462b7 Updated README.md
2018-06-01 4c21da4 images: cmdsubst.png
2018-06-01 b39996e *-highlight: Switch theme to secondary when descending into $() #15
2018-06-01 bf96045 themes: Equip all themes with key `secondary' (an alternate theme) #15
2018-06-01 aa1b112 fast-theme: Generate secondary theme (from key `secondary' in theme) #15
2018-06-01 6dd3bd3 *-highlight: Support for multiple active themes #15
2018-06-01 8a32944 *-highlight: Fix "$() found?" comparison
2018-06-01 3651605 *-highlight: Significant change: the parser is called recursively on $()
2018-05-31 882d88b test,*-highlight: New -ooo performance test; highlighter takes arguments
2018-05-31 5ba1178 *-highlight: Optimization - compute __arg length once
2018-05-30 b2a0126 *-highlight: Allow multiple separate options for `command', `exec' (#10)
2018-05-30 5804e9a *-highlight: Correct state after option for precommand (#10)
2018-05-30 1247b64 *-highlight: Simpler and more accurate option-testing for exec, command (#10)
2018-05-30 d87fed4 *-highlight: Correctly highlight options for `command' and `exec' (#10)
2018-05-30 8c3e75e *-highlight: Double-hyphen (--) stops option recognition and colorizing
2018-05-30 1c5a56c *-highlight: Support ${VAR} at command position (not only $VAR)
2018-05-30 f19d761 Updated README.md
2018-05-30 4a27351 images: for-loop
2018-05-30 4d650de themes: zdharma.ini to support for-loop
2018-05-30 45cafbc themes: safari.ini to support for-loop
2018-05-30 8bb9ee0 themes: free.ini to support for-loop
2018-05-30 f25a059 themes: forest.ini to support for-loop
2018-05-29 093d79e themes: default.ini to support for-loop
2018-05-29 446cb7b clean.ini,fast-theme: Clean-theme & theme subsystem to support for-loop
2018-05-29 1bb701f *-highlight: Move $variable highlighting from case to if-block
2018-05-29 b8413e9 *-highlight: For-loop highlighting, working, needs few upgrades
2018-05-28 7bec6e5 *-highlight: Three more simple vs. complex math operation optimizations
2018-05-27 baae683 *-highlight: Optimise complex math command into single one with & and ~
2018-05-27 2dc3103 *-highlight: Optimise complex math command into single one with & and ~
2018-05-27 291f905 _fast-theme: Update -t/--test description
2018-05-27 ec305f6 fast-theme: Help message treats about -t/--test
2018-05-27 0e1d19a Updated README.md
2018-05-27 5c3c911 Updated README.md
2018-05-26 76af248 themes: A fix for zdharma theme, 61 -> 63, a lighter color for builtins
2018-05-26 8eca0f2 *fast-theme: Ability to test theme after setting it (-t/--test)
2018-05-26 d3a7922 *-highlight: Fix in_array_assignment setting when closing ) found
2018-05-26 796c482 *-highlight: Make parameters' names exotic blank-var detection to work
2018-05-26 ae3913f _fast-theme: Complete theme names
2018-05-26 d212945 *-highlight,plugin.zsh,default.ini: Uplift of fg=112-fix code
2018-05-26 ee56f65 *-highlight,plugin.zsh: Final fix for fg=112 assignment  use zstyle
2018-05-26 391f5a4 fast-theme: Set `theme' zstyle in `:plugin:fast...' to given theme
2018-05-26 e0dc086 plugin.zsh: Fix the fg=112 assignment done for `variable' style
2018-05-26 17c9286 Updated README.md
2018-05-26 4774c1c fast-theme: Add completion for this function
2018-05-26 d971f39 fast-theme: Detect lack of theme name in arguments
2018-05-26 74f0d4d fast-theme: Use standard option parsing (zparseopts) and typical options
2018-05-26 d9c6180 New theme: `forest'
2018-05-26 419c156 New theme: `zdharma'
2018-05-26 a7735df gitignore
2018-05-26 99db69a New theme: `free'
2018-05-26 73619ff New theme: `clean'
2018-05-25 52307fb Theme support, 1 extra theme `safari'
2018-05-25 41df55b *-highlight: (k) subscript flag is sufficient, no need for (K)
2018-05-25 cb21c05 Updated README.md
2018-05-25 a580cff *-highlight: FAST_BLIST_PATTERNS
```

110
GALLERY.md Normal file
View file

@ -0,0 +1,110 @@
# Gallery Of Zplugin Invocations
```zsh
# PRs welcomed :)
#
# Programs
#
zplugin ice from"gh-r" as"program"
zplugin light junegunn/fzf-bin
zplugin ice from"gh-r" as"program" mv"docker* -> docker-compose"
zplugin light docker/compose
zplugin ice as"program" atclone"rm -f src/auto/config.cache; ./configure" atpull"%atclone" make pick"src/vim"
zplugin light vim/vim
zplugin ice as"program" make'!' atclone'./direnv hook zsh > zhook.zsh' atpull'%atclone' src"zhook.zsh"
zplugin light direnv/direnv
zplugin ice from"gh-r" as"program" mv"direnv* -> direnv"; zplugin light direnv/direnv
zplugin ice from"gh-r" as"program" mv"shfmt* -> shfmt"
zplugin light mvdan/sh
zplugin ice from"gh-r" as"program" mv"gotcha_* -> gotcha"
zplugin light b4b4r07/gotcha
zplugin ice as"program" pick"yank" make
zplugin light mptre/yank
zplugin ice wait"2" lucid as'command' pick'src/vramsteg' atclone'cmake .' atpull'%atclone' make # use turbo-mode
zplugin light psprint/vramsteg-zsh
#
# Completions
#
zplugin ice as"completion"
zplugin snippet https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
#
# Scripts
#
zplugin ice as"program" pick"$ZPFX/bin/git-*" make"PREFIX=$ZPFX" nocompile
zplugin light tj/git-extras
zplugin ice as"program" atclone'perl Makefile.PL PREFIX=$ZPFX' atpull'%atclone' make'install' pick"$ZPFX/bin/git-cal"
zplugin light k4rthik/git-cal
zplugin ice as"program" cp"wd.sh -> wd" pick"wd"
zplugin light mfaerevaag/wd
zplugin ice as"program" pick"bin/archey"
zplugin load obihann/archey-osx
#
# Plugins
#
zplugin ice pick"h.sh"
zplugin light paoloantinori/hhighlighter
#
# Snippets
#
zplugin ice svn pick"completion.zsh" src"git.zsh"
zplugin snippet OMZ::lib
zplugin ice svn wait"0" lucid atinit"local ZSH=\$PWD" \
atclone"mkdir -p plugins; cd plugins; ln -sfn ../. osx"
zplugin snippet OMZ::plugins/osx
# Or with most recent Zplugin and with ~/.zplugin/snippeds directory pruned (rm -rf -- ${ZPLGM[SNIPPETS_DIR]}):
zplugin ice svn
zplugin snippet OMZ::plugins/osx
#
# Themes
#
GEOMETRY_COLOR_DIR=152
zplugin ice wait"0" lucid atload"prompt_geometry_render"
zplugin light geometry-zsh/geometry
zplugin ice pick"async.zsh" src"pure.zsh"
zplugin light sindresorhus/pure
zplugin ice pick"powerless.zsh" src"utilities.zsh"
zplugin light martinrotter/powerless
zplugin light mafredri/zsh-async # dependency
zplugin ice svn silent atload'prompt sorin'
zplugin snippet PZT::modules/prompt
zplugin ice atload"fpath+=( \$PWD );"
zplugin light chauncey-garrett/zsh-prompt-garrett
zplugin ice svn atload"prompt garrett"
zplugin snippet PZT::modules/prompt
zplugin ice nocompletions atpull'prompt_zinc_compile' compile"{zinc_functions/*,segments/*,zinc.zsh}"
zplugin load robobenklein/zinc
# ZINC git info is already async, but if you want it even faster with gitstatus in turbo mode:
# https://github.com/romkatv/gitstatus
zplugin ice wait'1' atload'zinc_optional_depenency_loaded'
zplugin load romkatv/gitstatus
```

14
LICENSE
View file

@ -1,7 +1,7 @@
MIT License
This software is licensed under MIT.
Copyright (c) 2016-2020 Sebastian Gniazdowski and contributors
Copyright (c) 2021-2022 zdharma-continuum
MIT License
-----------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -10,13 +10,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,54 +1,32 @@
.EXPORT_ALL_VARIABLES:
all: zplugin.zsh.zwc zplugin-side.zsh.zwc zplugin-install.zsh.zwc zplugin-autoload.zsh.zwc
ZSH := $(shell command -v zsh 2> /dev/null)
SRC := zinit{'','-additional','-autoload','-install','-side'}.zsh
DOC_SRC := $(foreach wrd,$(SRC),../$(wrd))
%.zwc: %
doc/zcompile $<
.PHONY: all clean container doc doc/container tags tags/emacs tags/vim test zwc
clean:
rm -rf *.zwc doc/zsdoc/zinit{'','-additional','-autoload','-install','-side'}.zsh.adoc doc/zsdoc/data/
container:
docker build --tag=ghcr.io/zdharma-continuum/zinit:latest --file=docker/Dockerfile .
doc: clean
cd doc; zsh -l -d -f -i -c "zsd -v --scomm --cignore '(\#*FUNCTION:[[:space:]][\:\∞\.\+\@\-a-zA-Z0-9]*[\[]*|}[[:space:]]\#[[:space:]][\]]*)' $(DOC_SRC)"
doc/container: container
./scripts/docker-run.sh --docs --debug
# Run ctags to generate Emacs and Vim's format tag file.
tags: tags/emacs tags/vim
tags/emacs: ## Build Emacs-style ctags file
@if type ctags >/dev/null 2>&1; then \
if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \
ctags -e -R --options=share/zsh.ctags --languages=zsh \
--pattern-length-limit=250 --maxdepth=1; \
else \
ctags -e -R --languages=sh --langmap=sh:.zsh; \
fi; \
printf "Created the Emacs \`TAGS\` file.\\n"; \
else \
printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \
'version) utility first.\n'; \
fi
tags/vim: ## Build the Vim-style ctags file
@if type ctags >/dev/null 2>&1; then \
if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \
ctags --languages=zsh --maxdepth=1 --options=share/zsh.ctags --pattern-length-limit=250 -R; \
else \
ctags -R --languages=sh --langmap=sh:.zsh; \
fi; \
printf "Created the Vim's style \`tags\` file.\\n"; \
else \
printf 'Error: Please install a ctags first.\n'; \
fi
alltest: test testB testC testD testE
test:
zunit run
make VERBOSE=$(VERBOSE) NODIFF=$(NODIFF) DEBUG=$(DEBUG) OPTDUMP=$(OPTDUMP) OPTS=$(OPTS) -C test test
zwc:
$(or $(ZSH),:) -fc 'for f in *.zsh; do zcompile -R -- $$f.zwc $$f || exit; done'
testB:
make VERBOSE=$(VERBOSE) NODIFF=$(NODIFF) DEBUG=$(DEBUG) OPTDUMP=$(OPTDUMP) OPTS="kshglob" -C test test
testC:
make VERBOSE=$(VERBOSE) NODIFF=$(NODIFF) DEBUG=$(DEBUG) OPTDUMP=$(OPTDUMP) OPTS="noextendedglob" -C test test
testD:
make VERBOSE=$(VERBOSE) NODIFF=$(NODIFF) DEBUG=$(DEBUG) OPTDUMP=$(OPTDUMP) OPTS="ksharrays" -C test test
testE:
make VERBOSE=$(VERBOSE) NODIFF=$(NODIFF) DEBUG=$(DEBUG) OPTDUMP=$(OPTDUMP) OPTS="ignoreclosebraces" -C test test
doc: zplugin.zsh zplugin-side.zsh zplugin-install.zsh zplugin-autoload.zsh
rm -rf zsdoc/data zsdoc/*.adoc
zsd -v --scomm --cignore '(\#*FUNCTION:*{{{*|\#[[:space:]]#}}}*)' zplugin.zsh zplugin-side.zsh zplugin-install.zsh zplugin-autoload.zsh
clean:
rm -f zplugin.zsh.zwc zplugin-side.zsh.zwc zplugin-install.zsh.zwc zplugin-autoload.zsh.zwc
rm -rf zsdoc/data
.PHONY: all test clean doc
# vim:noet:sts=8:ts=8

1778
README.md

File diff suppressed because it is too large Load diff

View file

@ -1 +0,0 @@
3.17.0

397
_zinit
View file

@ -1,397 +0,0 @@
#compdef zinit
#autoload
#
# Zinit ZSH completion function
# Copyright (c) 2016-2020 Sebastian Gniazdowski
# Copyright (c) 2016-2023 zdharma-continuum
# Homepage: https://github.com/zdharma-continuum/zinit
# License: MIT License
#
# FUNCTION: __zinit_commands [[[
__zinit_commands(){
local -a commands
commands=(
'add-fpath:Add plugin folder to $FPATH'
'bindkeys:List of plugin defined key bindings'
'cclear:Clear completions list'
'cd:Go to a plugin or snippet direcorty'
'cdclear:Clear the compdef replay list'
'cdisable:Disable completions'
'cdlist:Show compdef replay list'
'cdreplay:Replay compdef list'
'cenable:Enable completions'
'changes:View plugins git log'
'compile:Compile plugin (or all plugins if --all passed)'
'compiled:List of compiled plugins'
'compinit:Refresh installed completions'
'completions:List status of all installed completions'
'create:Generate Zsh plugin boilerplate'
'creinstall:Install completions for plugin'
'csearch:Search for available completions from any plugin'
'cuninstall:Uninstall completions for plugin'
'debug:Functions for debugging Zinit'
'delete:Uninstall a plugin or snippet'
'edit:Edit a plugins or snippet with \$EDITOR'
'env-whitelist:Specify names (also patterns) of parameters to be left unchanged during an unload'
'glance:Look at plugins source'
'help:Usage information'
'load:Load plugin'
'man:Display Zinit'\''s manpage'
'module:Manage binary Zsh module shipped with Zinit'
'plugins:List status of all installed plugins'
'recall:Fetch saved ice modifiers and construct '
'recently:Show plugins that changed recently'
'report:Show plugins report'
'run:Run a command inside plugins folder'
'self-update:Fetch the newest version of Zinit from GitHub using `git`(1) and recompile'
'snippet:Source a local or remote file'
'snippets:List status of all installed snippets'
'srv:Control a service, command'
'status:Git status for plugin'
'stress:Test plugin for compatibility with set of options'
'times:Display brief statistics for your Zinit installation'
'uncompile:Remove compiled plugin'
'uninstall:Uninstall a formula or cask'
'unload:Unload a plugin or snippet'
'update:Upgrade outdated plugins and snippets using the same options they were originally installed with'
'version:Print the version numbers of Zinit to standard output'
'zstatus:Overall Zinit status'
)
_describe -t commands 'zinit commands' commands
} # ]]]
###
# Commands in the debug context
###
_zinit_debug_commands=(
'clear:Clear report of debug tracing session'
'report:Show report of debug tracing session'
'revert:Revert changes detected during debug tracing session'
'start:Start debug tracing session'
'status:Show current state of debug mode'
'stop:Stop debug tracing session'
)
# FUNCTION: __zinit_completion_caching_policy [[[
__zinit_completion_caching_policy(){
local -a tmp
(( $#tmp )) || return 0
tmp=( $ZINIT[BIN_DIR]/*.git/index(om[1]N) )
[[ -z $tmp || $tmp -nt $1 ]]
} # ]]]
# FUNCTION: __zinit_installed [[[
__zinit_installed() {
_alternative \
'plugins:installed:__zinit_installed_plugins' \
'snippets:installed:__zinit_installed_snippets'
} # ]]]
# FUNCTION: __zinit_installed_plugins [[[
__zinit_installed_plugins(){
# [[ -prefix '-' ]] && return 0
typeset -a list
local expl
list=( "${ZINIT[PLUGINS_DIR]}"/*(N:t) )
list=( "${list[@]//---//}" )
list=( "${list[@]:#_local/zinit}" )
list=( "${list[@]:#custom}" )
_wanted list expl 'plugins' compadd -a - list
} # ]]]
# FUNCTION: __zinit_installed_snippets [[[
__zinit_installed_snippets(){
# [[ -prefix '-' ]] && return 0
typeset -a snippets
local expl
snippets=( "${ZINIT[SNIPPETS_DIR]}"/**/._zinit(D/:h) )
snippets=( ${(Q)snippets[@]#${ZINIT[SNIPPETS_DIR]}/} )
# formulae=( ${(qq)formulae[@]/(#b)(http|https|ftp|ftps|scp)--/${match[1]}://} )
# formulae=( ${formulae[@]/--//} )
#
_wanted snippets expl 'snippets' compadd -a - snippets
} # ]]]
# FUNCTION: __zinit_list_aliases [[[
__zinit_list_aliases(){
local -a aliases
aliases=( ls list uninstall delete )
builtin print -- "$aliases"
} # ]]]
# FUNCTION: _zinit_add_fpath [[[
_zinit_add_fpath(){
_arguments -A \
'(-h --help)'{-h,--help}'[Show this help message]' && ret=0
} # ]]]
# FUNCTION: _zinit_bindkeys [[[
_zinit_bindkeys(){
_message 'Hit enter to list the defined key bindings replay' && ret=0
} # ]]]
# FUNCTION: _zinit_cclear [[[
_zinit_cclear(){
_arguments -A \
'(-h --help)'{-h,--help}'[Show this help message]' \
'(-q --quiet)'{-q,--quiet}'[Turn off messages from the operation]' \
&& ret=0
} # ]]]
# FUNCTION: _zinit_cd [[[
_zinit_cd(){
_arguments - plugin '1::plugin:__zinit_installed_plugins' && ret=0
} # ]]]
# FUNCTION: _zinit_cdclear [[[
_zinit_cdclear(){
_arguments -A \
'(-h --help)'{-h,--help}'[Show this help message]' \
'(-q --quiet)'{-q,--quiet}'[Turn off messages from the operation]' \
&& ret=0
} # ]]]
# FUNCTION: _zinit_cdisable [[[
_zinit_cdisable(){
_message 'Press enter to disable completions' && ret=0
} # ]]]
# FUNCTION: _zinit_cdlist [[[
_zinit_cdlist(){
_message 'List of compdef replays' && ret=0
} # ]]]
# FUNCTION: _zinit_cdreplay [[[
_zinit_cdreplay(){
_arguments -A \
'(-h --help)'{-h,--help}'[Show this help message]' \
'(-q --quiet)'{-q,--quiet}'[Turn off messages from the operation]' \
&& ret=0
} # ]]]
# FUNCTION: _zinit_cenable [[[
_zinit_cenable(){
_message 'Hit enter to enable completions' && ret=0
} # ]]]
# FUNCTION: _zinit_changes [[[
_zinit_changes(){
_message 'View git log of a plugin' && ret=0
} # ]]]
# FUNCTION: _zinit_compiled [[[
_zinit_compiled(){
_message 'Hit enter to get list of compiled plugins and snippets'
} # ]]]
# FUNCTION: _zinit_compinit [[[
_zinit_compinit(){
_message "Refresh completions" && ret=0
} # ]]]
# FUNCTION: _zinit_completions [[[
_zinit_completions(){
_message "Display a list of completions" && ret=0
} # ]]]
# FUNCTION: _zinit_compile [[[
_zinit_compile(){
_arguments \
'(-h --help)'{-h,--help}'[Show this help message]' \
'(-q --quiet)'{-q,--quiet}'[Make some output more quiet]' \
+ '(operation)' \
'(-a --all)'{-a,--all}'[Compile all plugins]' \
'*::installed:__zinit_installed' \
&& ret=0
} # ]]]
# FUNCTION: _zinit_create [[[
_zinit_create(){
_arguments \
'1:Plugin Name' && ret=0
} # ]]]
# FUNCTION: _zinit_creinstall [[[
_zinit_creinstall(){
_arguments - plugin '1::plugin:__zinit_installed_plugins' && ret=0
} # ]]]
# FUNCTION: _zinit_csearch [[[
_zinit_csearch(){
ret=0
} # ]]]
# FUNCTION: _zinit_cuninstall [[[
_zinit_cuninstall(){
_arguments - installed '*::installed:__zinit_installed' && ret=0
} # ]]]
# FUNCTION: _zinit_delete [[[
_zinit_delete(){
_arguments \
{-d,--debug}'[Enable xtrace]' \
{-h,--help}'[Show this help message]' \
{-q,--quiet}'[Make some output more quiet]' \
{-y,--yes}'[Automatically confirm any yes/no prompts]' \
+ '(operation)' \
'*::installed:__zinit_installed' \
{-a,--all}'[Delete all plugins and snippets]' \
{-c,--clean}'[Delete only the currently-not loaded plugins and snippets]' \
&& ret=0
} # ]]]
_zinit_debug(){
_arguments \
'1: :_zinit_debug_cmds'
} # ]]]
# FUNCTION: _zinit_edit [[[
_zinit_edit(){
_arguments \
- installed '*::plugin:__zinit_installed_plugins' \
- snippet '*::snippet:__zinit_installed_snippets' && ret=0
} # ]]]
# FUNCTION: _zinit_env_whitelist [[[
_zinit_env_whitelist(){
_arguments -A \
'(-h --help)'{-h,--help}'[Show this help message]' \
'(-v --verbose)'{-v,--verbose}'[Make some output more verbose]' \
&& ret=0
} # ]]]
# FUNCTION: _zinit_glance [[[
_zinit_glance(){
_arguments - installed '1:installed:__zinit_installed' && ret=0
} # ]]]
# FUNCTION: _zinit_help [[[
_zinit_help(){
_message 'Hit enter for usage information' && ret=0
} # ]]]
# FUNCTION: _zinit_man [[[
_zinit_man(){
_message "Hit enter to view the Zinit man page" && ret=0
} # ]]]
# FUNCTION: _zinit_module [[[
_zinit_module(){
_arguments \
- subcommand '*::subcommand:(build help info)' && ret=0
} # ]]]
# FUNCTION: _zinit_plugins [[[
_zinit_plugins(){
_message 'Hit enter to list the status of all installed plugins' && ret=0
} # ]]]
# FUNCTION: _zinit_recall [[[
_zinit_recall(){
_message 'Hit enter to list the defined key bindings replay' && ret=0
} # ]]]
# FUNCTION: _zinit_recently [[[
_zinit_recently(){
ret=0
} # ]]]
# FUNCTION: _zinit_report [[[
_zinit_report(){
_message 'Hit enter to list the defined key bindings replay' && ret=0
} # ]]]
# FUNCTION: _zinit_run [[[
_zinit_run(){
_arguments \
- installed '1:installed:__zinit_installed' \
'2:command to run:' && ret=0
} # ]]]
# FUNCTION: _zinit_self_update [[[
_zinit_self_update(){
_arguments -A \
'(-h --help)'{-h,--help}'[Show this help message]' \
'(-n --no-pager)'{-n,--no-pager}'[Disable the use of the pager]' \
'(-q --quiet)'{-q,--quiet}'[Turn off messages from the operation]' \
&& ret=0
} # ]]]
# FUNCTION: _zinit_snippet [[[
_zinit_snippet(){
_arguments -A \
'(-c --command)'{-c,--command}'[Load the snippet as a command (i.e., make executable and apend to \$PATH)]' \
'(-f --force)'{-f,--force}'[Force new download of the snippet file]' \
'(-h --help)'{-h,--help}'[Show this help message]'
_arguments - snippet '*::snippet:__zinit_installed_snippets' && ret=0
} # ]]]
# FUNCTION: _zinit_snippets [[[
_zinit_snippets(){
_message 'Hit enter to list the status of all installed snippets' && ret=0
} # ]]]
# FUNCTION: _zinit_srv [[[
_zinit_srv(){
_message 'Hit enter to control a service' && ret=0
} # ]]]
# FUNCTION: _zinit_status [[[
_zinit_status(){
_message 'Display current status of Zinit' && ret=0
} # ]]]
# FUNCTION: _zinit_stress [[[
_zinit_stress(){
_message 'Stress' && ret=0
} # ]]]
# FUNCTION: _zinit_times [[[
_zinit_times(){
_arguments \
'--help[Show this help message]' \
+ '(operation)' \
'(-a --all)'{-a,--all}'[show both load times and loading moments]' \
'(-m --moments)'{-m,--moments}'[Display loading moments]' \
'(-s --seconds)'{-s,--seconds}'[Load times displayed in seconds]' \
&& ret=0
} # ]]]
# FUNCTION: _zinit_uncompile [[[
_zinit_uncompile(){
_arguments \
'(-h --help)'{-h,--help}'[Show this help message]' \
'(-q --quiet)'{-q,--quiet}'[Make some output more quiet]' \
+ '(operation)' \
'(-a --all)'{-a,--all}'[Uncompile all plugins]' \
'*::installed:__zinit_installed' \
&& ret=0
} # ]]]
# FUNCTION: _zinit_uninstall [[[
_zinit_uninstall(){
_message 'Hit enter to uninstall a formula or cask' && ret=0
} # ]]]
# FUNCTION: _zinit_unload [[[
_zinit_unload(){
_arguments -A \
'(-h --help)'{-h,--help}'[Show this help message]' \
'(-q --quiet)'{-q,--quiet}'[Turn off messages from the operation]' \
- installed '*:installed:__zinit_installed'
} # ]]]
# FUNCTION: _zinit_update [[[
_zinit_update(){
_arguments \
'(-h --help)'{-h,--help}'[Show this help message]' \
'(-n --no-pager)'{-n,--no-pager}'[Disable the use of the pager]' \
'(-q --quiet)'{-q,--quiet}'[Turn off almost-all messages from the update operation FOR the objects which don'\''t have any new version available]' \
'(-r --reset)'{-r,--reset}'[Reset the repository before updating (or remove the files for single-file snippets and gh-r plugins)]' \
'(-s --snippets)'{-s,--snippets}'[Update only snippets (i.e.: skip updating plugins)]' \
'(-u --urge)'{-u,--urge}'[Cause all the hooks like: atpull'\'\'', cp'\'\'', etc. to execute even when there aren'\''t any new commits / any new version of the gh-r file / etc.… available for download↔ simulate a non-empty update]' \
'(-v --verbose)'{-v,--verbose}'[Turn on more messages from the operation]' \
- set1 \
'(-p --parallel)'{-p,--parallel}'[Turn on concurrent, multi-thread update (of all objects)]' \
'(-a --all)'{-a,--all}'[Update all plugins and snippets]' \
- set2 \
'1:installed:__zinit_installed'
} # ]]]
# FUNCTION: _zinit_version [[[
_zinit_version(){
_message 'Hit enter to print the version numbers of Zinit' && ret=0
} # ]]]
# FUNCTION: _zinit_zstatus [[[
_zinit_zstatus(){
_message 'Hit enter to show the overall Zinit status' && ret=0
} # ]]]
# FUNCTION: _zinit_load [[[
_zinit_load() {
_message 'Hit enter to list the defined key bindings replay' && ret=0
} # ]]]
# FUNCTION: _zinit [[[
_zinit(){
local curcontext="$curcontext" state state_descr line expl
local tmp ret=1
_arguments -A \
'(-h --help)'{-h,--help}'[Show this help message]'
_arguments -C \
"1: :->cmds" \
"*::arg:->args"
case "$state" in
cmds)
__zinit_commands && return 0
;;
args)
local cmd="${line[1]}"
curcontext="${curcontext%:*}-${cmd}:${curcontext##*:}"
local completion_func="_zinit_${cmd//-/_}"
_call_function ret "${completion_func}" && return ret
_message "a completion function is not defined for command or alias: ${cmd}"
return 1
;;
esac
} # ]]]
(( $+functions[_zinit_debug_cmds] )) || _zinit_debug_cmds() {
_describe -t commands 'commands' _zinit_debug_commands "$@"
}
_zinit "$@"
#vim: filetype=zsh foldmarker=[[[,]]] foldmethod=marker shiftwidth=2 softtabstop=2 tabstop=2:

268
_zplugin Normal file
View file

@ -0,0 +1,268 @@
#compdef zplugin
local context state state_descr line ret=1
typeset -A opt_args
typeset -a commands
commands=(
zstatus:'overall Zplugin status'
times:'statistics on plugin loading times'
self-update:'updates Zplugin'
help:'usage information'
man:'manual'
env-whitelist:'specify names (also patterns) of parameters to be left unchanged during an unload'
load:'load plugin'
delete:'delete plugin'
unload:'unload plugin'
snippet:"source (or add to PATH with --command) local or remote file (-f: force - don't use cache)"
update:'Git update plugin (or all plugins and snippets if --all passed)'
status:'Git status for plugin (or all plugins if --all passed)'
report:'show plugin'"'"'s report (or all plugins'"'"' if --all passed)'
loaded:'show what plugins are loaded'
list:'show what plugins are loaded'
ls:'list snippets in formatted and colorized manner'
cd:"go into plugin's directory"
create:'create plugin (also together with Github repository)'
edit:"edit plugin's file with \$EDITOR"
glance:"look at plugin's source (pygmentize, {,source-}highlight)"
stress:'test plugin for compatibility with set of options'
changes:"view plugin's git log"
recently:"show plugins that changed recently, argument is e.g. 1 month 2 days"
clist:'list completions in use'
cclear:'clear stray and improper completions'
completions:'list completions in use'
cdisable:'disable completion'
cenable:'enable completion'
creinstall:'install completions for plugin'
cuninstall:'uninstall completions for plugin'
csearch:'search for available completions from any plugin'
compinit:'refresh installed completions'
dtrace:"start tracking what's going on in session"
dstart:"start tracking what's going on in session"
dstop:"stop tracking what's going on in session"
dunload:'revert changes recorded between dstart and dstop'
dreport:"report what was going on in session"
dclear:'clear report of what was going on in session'
compile:'compile plugin (or all plugins if --all passed)'
uncompile:'remove compiled version of plugin (or of all plugins if --all passed)'
compiled:'show which plugins are compiled'
cdlist:'show compdef replay list'
cdreplay:'replay compdefs (to be done after compinit)'
cdclear:'clear compdef replay list'
)
_arguments -C \
'1: :->command'\
'*: :->argument' && ret=0
case $state in
command)
_describe -t commands "Zplugin command" commands && ret=0
;;
argument)
case $words[2] in
help)
_message "Hit enter to get usage information" && ret=0
;;
man)
_message "Hit enter to view manual" && ret=0
;;
zstatus)
_message "Hit enter to get overall status information" && ret=0
;;
times)
_message "Hit enter to get plugin load time statistics" && ret=0
;;
load|light|compile|stress|edit|glance)
typeset -a plugins
plugins=( "${ZPLGM[PLUGINS_DIR]}"/*(N:t) )
plugins=( "${plugins[@]//---//}" )
plugins=( "${plugins[@]:#_local/zplugin}" )
plugins=( "${plugins[@]:#custom}" )
# _wanted plugins expl "Plugins" \
# compadd "$@" -a - plugins && ret=0
_alternative 'directories:directory:_directories' 'plugins:plugin:compadd -a - plugins'
;;
update|status|cd|changes)
typeset -a plugins
plugins=( "${ZPLGM[PLUGINS_DIR]}"/*(N:t) )
plugins=( "${plugins[@]//---//}" )
plugins=( "${plugins[@]:#_local/zplugin}" )
plugins=( "${plugins[@]:#custom}" )
_wanted plugins expl "Plugins" \
compadd "$@" -a - plugins && ret=0
;;
delete)
typeset -a plugins
plugins=( "${ZPLGM[PLUGINS_DIR]}"/*(N:t) )
plugins=( "${plugins[@]//---//}" )
plugins=( "${plugins[@]:#_local/zplugin}" )
plugins=( "${plugins[@]:#custom}" )
_wanted plugins expl "Plugins" \
compadd "$@" -a - plugins && ret=0
;;
unload|report)
typeset -a plugins absolute normal
plugins=( "${ZPLG_REGISTERED_PLUGINS[@]:#_local/zplugin}" )
normal=( "${plugins[@]:#%*}" )
absolute=( "${(M)plugins[@]:#%*}" )
absolute=( "${absolute[@]/\%\/\//%/}" )
local hm="${HOME%/}"
absolute=( "${absolute[@]/$hm/HOME}" )
plugins=( $absolute $normal )
_wanted plugins expl "Plugins" \
compadd "$@" -a - plugins && ret=0
;;
all-reports)
_message "Hit enter to get all reports (for all loaded plugins)" && ret=0
;;
loaded|list)
_message "Hit enter or give part of plugin name" && ret=0
;;
clist|completions)
_message "Hit enter to get list of completions" && ret=0
;;
cclear)
_message "Hit enter to clear stray and improper completions" && ret=0
;;
cdisable)
# Find enabled completions
typeset -a completions
completions=( "${ZPLGM[COMPLETIONS_DIR]}"/_*(N:t) )
completions=( "${completions[@]#_}" )
compadd "$@" -a - completions && ret=0
;;
cenable)
# Find disabled
typeset -a completions
completions=( "${ZPLGM[COMPLETIONS_DIR]}"/[^_]*(N:t) )
compadd "$@" -a - completions && ret=0
;;
creinstall)
# Complete only plugins that have any completions
# We must iterate each plugin to check
# for completions that can be installed
typeset -a plugins completions
local p c user plugin
for p in "${ZPLGM[PLUGINS_DIR]}"/*; do
completions=( "$p"/**/_[^_.][^.]#(N) )
for c in "${completions[@]}"; do
p="${p:t}"
user="${p%%---*}"
plugin="${p#*---}"
[[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user=""
plugins+=( "${user:+$user/}$plugin" )
break
done
done
_wanted plugins expl "Plugins" \
compadd "$@" -a - plugins && ret=0
;;
cuninstall)
# We must iterate each plugin and check if
# it has completions that are installed
typeset -a plugins completions
local p c user plugin
for p in "${ZPLGM[PLUGINS_DIR]}"/*; do
completions=( "$p"/**/_[^_.][^.]#(N) )
for c in "${completions[@]}"; do
cfile="${c:t}"
bkpfile="${cfile#_}"
# Completion installed, either enabled or disabled?
if [[ -e "${ZPLGM[COMPLETIONS_DIR]}"/"$cfile" || -e "${ZPLGM[COMPLETIONS_DIR]}"/"$bkpfile" ]]; then
p="${p:t}"
user="${p%%---*}"
plugin="${p#*---}"
[[ "$user" = "$plugin" && "${user}---${plugin}" != "$p" ]] && user=""
plugins+=( "${user:+$user/}$plugin" )
break
fi
done
done
_wanted plugins expl "Plugins" \
compadd "$@" -a - plugins && ret=0
;;
compinit)
_message "Hit enter to refresh completion system" && ret=0
;;
snippet)
typeset -a soptions
soptions=( "-f" "--command" )
_wanted soptions expl "Options" \
compadd "$@" -a - soptions && ret=0
;;
dstart|dtrace)
_message "Hit enter to start tracking this session" && ret=0
;;
dstop)
_message "Hit enter to stop tracking this session" && ret=0
;;
dunload)
_message "Hit enter to revert changes recorded between dstart and dstop" && ret=0
;;
dreport)
_message "Hit enter to show report of what was going on in session" && ret=0
;;
dclear)
_message "Hit enter to clear report of what was going on in session" && ret=0
;;
compile-all)
_message 'Hit enter to compile all downloaded plugins' && ret=0
;;
uncompile)
typeset -a plugins
plugins=( "${ZPLGM[PLUGINS_DIR]}"/*(N) )
typeset -a show_plugins p matches
for p in "${plugins[@]}"; do
matches=( $p/*.zwc(N) )
if [ "$#matches" -ne "0" ]; then
p="${p:t}"
[ "$p" = "_local---zplugin" ] && continue
[ "$p" = "custom" ] && continue
p="${p//---//}"
show_plugins+=( "$p" )
fi
done
_wanted show_plugins expl "Plugins" \
compadd "$@" -a - show_plugins && ret=0
;;
uncompile-all)
_message 'Hit enter remove compiled versions of all downloaded plugins' && ret=0
;;
compiled)
_message 'Hit enter to get list of compiled plugins' && ret=0
;;
cdlist)
_message 'Hit enter to show compdef replay list' && ret=0
;;
cdreplay)
_message 'Hit enter to replay recorded compdefs' && ret=0
;;
cdclear)
_message 'Hit enter to clear compdef replay list' && ret=0
;;
recently)
typeset -a timespecs
timespecs=(
"3 days":"code modified during last 3 days"
"1 week":"code modified during last 7 days (default)"
"1 month":"code modified during last month"
)
_describe -t timespecs "Time spec" timespecs && ret=0
;;
create)
_message 'Plugin spec or just enter, to create new plugin' && ret=0
;;
*)
ret=1
;;
esac
esac
return "$ret"

View file

@ -1,735 +0,0 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [Changelog](#changelog)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Changelog
All notable changes to this project will be documented in this file.
- 29-11-2021
- zinit calls no longer silently fail when ices such as `atclone`, `atpull` or `compile` fail. Any hook returning with
!= 0 will log a warning to stdout at runtime:
```zsh
zinit null atclone'echo "intentional failure"; return 69' \
for zdharma-continuum/null
echo $?
69
```
- 28-11-2021
- **‼️ BREAKING CHANGE** zinit now requires [jq](https://github.com/stedolan/jq) for JSON parsing. This only affects
the `pack` ice. Users who do not have jq installed will be greeted with a warning when they try to install packages.
To install jq with zinit, you can follow
[these instructions in the wiki](https://github.com/zdharma-continuum/zinit/wiki/%F0%9F%A7%8A-Recommended-ices#jq)
- `zinit pack` now better supports installation from local files (previously only relative paths worked), and **custom
repositories!** By default, zinit uses
[zhdarma-continuum/zinit-packages](https://github.com/p/zdharma-continuum/zinit-packages).
To use a custom repo you can set `ZINIT[PACKAGES_REPO]=github_org/repo`.
For installing from a specific branch you can:
1. Leverage the `ver` ice (eg: `ver"my-branch`)
1. Override zinit's default branch with `ZINIT[PACKAGES_BRANCH]=my-branch`
zinit package repos that are not hosted on GitHub can be installed from the local filesystem like so:
`zinit pack"local/path/to/package.json:profile" for mypackage`
- 22-11-2021
- We updated zinit's main branch from `master` to `main`. `zinit self-update` will try to update the branch locally.
If it fails please try to:
```zsh
cd ${ZINIT[BIN_DIR]}
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
```
- 21-11-2021
- [(z)unit tests](https://github.com/zdharma-continuum/zinit/actions/workflows/tests.yaml) have been added to our dear
repository. This should help us to sniff out some bugs and improve the overall quality of zinit. Stay tuned! More
information available [here](https://github.com/zdharma-continuum/zinit/pull/96).
- 20-11-2021
- zinit is now [XDG compliant](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). This
means that the default value of `ZINIT[HOME_DIR]` is now `XDG_DATA_HOME/zinit`, ie `HOME/.local/share/zinit`, we
won't clutter your `HOME` anymore! Fear not though: if you update zinit without moving your config to the new
default location it will still fall back to `HOME/.zinit` if this directory exists. In the same spirit, if you
overrode `ZINIT[HOME_DIR]` yourself in your `zshrc` we will use that value instead. NOTE: Since its rewrite the
installer has been installing zinit's repo to `XDG_DATA_HOME/zinit/zinit.git` (see 16-11-2021 entry)
- 18-11-2021
- The packages (`zinit pack`) have all been migrated to
[a new repository](https://github.com/zdharma-continuum/zinit-packages). Nothing fundamentally changes for users,
the original repos have only been archived and not deleted, so that older zinit versions can still use these.
For more information, please refer to [this issue](https://github.com/zdharma-continuum/zinit/issues/69) and/or to
[the corresponding PR](https://github.com/zdharma-continuum/zinit/pull/75)
- The zinit module has been relocated to [its own repository](https://github.com/zdharma-continuum/zinit-module)
* 17-11-2021
- Containers! If you want to try out zinit inside a container, you can now. Several versions of zsh are available, as
well as arm64. Check out the available tags on
[ghcr](https://github.com/zdharma-continuum/zinit/pkgs/container/zinit).
```shell
docker run -it --rm ghcr.io/zdharma-continuum/zinit:latest
```
- 16-11-2021
- A brand-new installer has been developed. A few new features have been added. There are a bunch of new env vars you
can set:
- `NO_INPUT=1`: non-interactive mode (`NO_INPUT=1`)
- `NO_EDIT=1`: do not modify `.zshrc`
- `ZSHRC=/home/user01/.config/zsh/zshrc`: custom path to your `.zshrc`
- `ZINIT_REPO=zdharma-continuum/zinit`: Install zinit from a custom GitHub repo
- `ZINIT_BRANCH=master`: zinit branch to install
- `ZINIT_COMMIT=master`: zinit commit to install (takes precedence over `ZINIT_BRANCH`)
- `ZINIT_INSTALL_DIR=~/.local/share/zinit/zinit.git`: Where to install the zinit repo
⚠️ Please note that the download URL for the installer has changed. It is now:
https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh
For more details check out [PR #61](https://github.com/zdharma-continuum/zinit/pull/61)
- 11-11-2021
- The annexes repos have been renamed to improve discoverability. They used to be called `z-a-${name}` and have been
renamed to `zinit-annex-${name}`. You don't *need* to update your configs right away since GitHub redirects to the
new URLs.
- 06-11-2021
- 🚧 zinit has a new home: https://github.com/zdharma-continuum/zinit
- The migration from @zdharma, @Zsh-Packages and @zinit-zsh is still in progress. If you are interested in helping
or want to let us know that a particular project is missing, please head to
[I_WANT_TO_HELP](https://github.com/zdharma-continuum/I_WANT_TO_HELP/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
- 📚 zinit now ensures that the man dirs under `$ZPFX/man` are created on startup. Please note that these directories
will not necessarily be part of your `manpath`. You may need to set `$MANPATH`. See #8 (and #7) for more details.
- 21-01-2020
- A few tips for the project rename following the field reports (the issues created by users):
- the `ZPLGM` hash is now `ZINIT`,
- the annexes are moved under [zinit-zsh](https://github.com/zinit-zsh) organization (it needs a logo, could you
create one, if you're skilled in graphics?).
- 19-01-2020
- The name has been changed to **Zinit** based on the results of the
[poll](https://web.archive.org/web/20201008014128/https://github.com/zdharma/zinit/issues/235)
- In general, you don't have to do anything after the name change.
- Only a run of `zinit update --all` might be necessary.
- You might also want to rename your `zplugin` calls in `zshrc` to `zinit`.
- Zinit will reuse `~/.zplugin` directory if it exists, otherwise it'll create `~/.zinit`.
- 15-01-2020
- There's a new function, `zpextract`, which unpacks the given file. It supports many formats (notably also `dmg`
images) if there's a format that's unsupported please don't hesitate to
[make a request](https://github.com/zdharma-continuum/zinit/issues/new?assignees=&labels=%F0%9F%8E%81+feature+request%2C%F0%9F%8E%B2+triage&template=feature-request.yml&title=%F0%9F%8E%81+Feature+request%3A+)
for it to be added. A few facts:
- the function is available only at the time of the plugin/snippet installation,
- it's to be used within `atclone` and `atpull` ices,
- it has an optional `--move` option which moves all the files from a subdirectory up one level,
- one other option `--norm` prevents the archive from being deleted upon unpacking.
- snippets now aren't re-downloaded unless they're newer on the HTTP server; use this with the `--norm` option of
`zpextract` to prevent unnecessary updates; for example, the
[firefox-dev package](https://github.com/zdharma-continuum/zsh-package-firefox-dev) uses this option for this
purpose,
- GitHub doesn't report proper `Last-Modified` HTTP server for the files in the repositories so the feature doesn't
yet work with such files.
- 13-12-2019
- The packages have been disconnected from NPM registry and now live only on Zsh Packages organization. Publishing to
NPM isn't needed.
- There are two interesting packages, [any-gem](https://github.com/zdharma-continuum/zsh-package-any-gem) and
[any-node](https://github.com/zdharma-continuum/zsh-package-any-node). They allow to install any Gem(s) or Node
module(s) locally in a newly created plugin directory. For example:
```zsh
zinit pack param='GEM -> rails' for any-gem
zinit pack param='MOD -> doctoc' for any-node
# To have the command in zshrc, add an id-as'' ice so that
# Zinit knows that the package is already installed
# (also: the Unicode arrow is allowed)
zinit id-as=jekyll pack param='GEM → jekyll' for any-gem
```
The binaries will be exposed without altering the PATH via shims
([Bin-Gem-Node](https://github.com/zinit-zsh/zinit-annex-bin-gem-node) annex is needed). Shims are correctly removed
when deleting a plugin with `zinit delete …`.
- 11-12-2019
- Zinit now supports installing special-Zsh NPM packages! Bye-bye the long and complex ice-lists! Check out the
[Wiki](https://zdharma-continuum.github.io/zinit/wiki/NPM-Packages/) for an introductory document on the feature.
- 25-11-2019
- A new subcommand `run` that executes a command in the given plugin's directory. It has an `-l` option that will
reuse the previously provided plugin. So that it's possible to do:
```zsh
zplg run my/plugin ls
zplg run -l cat \*.plugin.zsh
zplg run -l pwd
```
- 07-11-2019
- Added a prefix-char: `@` that can be used before plugins if their name collides with one of the ice-names. For
example `sharkdp/fd` collides with the `sh` ice (which causes the plugin to be loaded with the POSIX `sh` emulation
applied). To load it, do e.g.:
```zsh
zinit as"null" wait"2" lucid from"gh-r" for \
mv"exa* -> exa" sbin"exa" ogham/exa \
mv"fd* -> fd" sbin"fd/fd" @sharkdp/fd \
sbin"fzf" junegunn/fzf-bin
```
i.e.: precede the plugin name with `@`. Note: `sbin''` is an ice added by the
[zinit-annex-bin-gem-node](https://github.com/zinit/zinit-annex-bin-gem-node) annex, it provides the command to the
command line without altering `$PATH`.
See the [Zinit Wiki](https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/) for more information on the
for-syntax.
- 06-11-2019
- A new syntax, called for-syntax. Example:
```zsh
zinit as"program" atload'print Hi!' for \
atinit'print First!' zdharma/null \
atinit'print Second!' svn OMZ::plugins/git
```
The output:
```
First!
Hi!
Second!
Hi!
```
And also:
```zsh
% print -rl $path | egrep -i '(/git|null)'
/root/.zinit/snippets/OMZ::plugins/git
/root/.zinit/plugins/zdharma---null
```
To load in light mode, use a new `light-mode` ice. More examples and information can be found on the
[Zinit Wiki](https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/).
- 03-11-2019
- A new value for the `as''` ice `null`. Specifying `as"null"` is like specifying `pick"/dev/null" nocompletions`,
i.e.: it disables the sourcing of the default script file of a plugin or snippet and also disables the installation
of completions.
- 30-10-2019
- A new ice `trigger-load''` create a function that loads given plugin/snippet, with an option (to use it, precede
the ice content with `!`) to automatically forward the call afterwards. Example use:
```zsh
# Invoking the command `crasis' will load the plugin that
# provides the function `crasis', and it will be then
# immediately invoked with the same arguments
zinit ice trigger-load'!crasis'
zinit load zdharma/zinit-crasis
```
- 22-10-2019
- A new ice `countdown` causes an interruptable (by Ctrl-C) countdown 5…4…3…2…1…0 to be displayed before running the
`atclone''`, `atpull''` and `make` ices.
- 21-10-2019
- The `times` command has a new option `-m` it shows the **moments** of the plugin load times i.e.: how late after
loading Zinit a plugin has been loaded.
- 20-10-2019
- The `zinit` completion now completes also snippets! The command `snippet`, but also `delete`, `recall`, `edit`,
`cd`, etc. all receive such completing.
- The `ice` subcommand can now be skipped just pass in the ices, e.g.:
```zsh
zinit atload"zicompinit; zicdreplay" blockf
zinit light zsh-users/zsh-completions
```
- The `compile` command is able to compile snippets.
- The plugins that add their subdirectories into `$fpath` can be now `blockf`-ed the functions located in the dirs
will be correctly auto-loaded.
- 12-10-2019
- Special value for the `id-as''` ice `auto`. It sets the plugin/snippet ID automatically to the last component of
its spec, e.g.:
```zsh
zinit ice id-as"auto"
zinit load robobenklein/zinc
```
will load the plugin as `id-as'zinc'`.
- 14-09-2019
- There's a Vim plugin which extends syntax highlighting of zsh scripts with coloring of the Zinit commands.
[Project homepage](https://github.com/zinit/zinit-vim-syntax).
- 13-09-2019
- New ice `aliases` which loads plugin with the aliases mechanism enabled. Use for plugins that define **and use**
aliases in their scripts.
- 11-09-2019
- New ice-mods `sh`,`bash`,`ksh`,`csh` that load plugins (and snippets) with the **sticky emulation** feature of Zsh
all functions defined within the plugin will automatically switch to the desired emulation mode before executing and
switch back thereafter. In other words it is now possible to load e.g. bash plugins with Zinit, provided that the
emulation level done by Zsh is sufficient, e.g.:
```zsh
zinit ice bash pick"bash_it.sh" \
atinit"BASH_IT=${ZINIT[PLUGINS_DIR]}/Bash-it---bash-it" \
atclone"yes n | ./install.sh"
zinit load Bash-it/bash-it
```
This script loads correctly thanks to the emulation, however it isn't functional because it uses `type -t …` to
check if a function exists.
- 10-09-2019
- A new ice-mod `reset''` that ivokes `git reset --hard` (or the provided command) before `git pull` and `atpull''`
ice. It can be used it to implement altering (i.e. patching) of the plugin's files inside the `atpull''` ice `git`
will report no conflicts when doing `pull`, and the changes can be then again introduced by the `atpull''` ice..
- Three new Zplugin annexes (i.e. [extensions](https://zdharma-continuum.github.io/zplugin/wiki/Annexes/)):
- [zinit-annex-man](https://github.com/zplugin/zinit-annex-man)
Generates man pages and code-documentation man pages from plugin's README.md and source files (the code
documentation is obtained from [Zshelldoc](https://github.com/zdharma/zshelldoc)).
- [zinit-annex-test](https://github.com/zplugin/zinit-annex-test)
Runs tests (if detected `test' target in a `Makefile`or any`\*.zunit\` files) on plugin installation and non-empty
update.
- [zinit-annex-patch-dl](https://github.com/zplugin/zinit-annex-patch-dl)
Allows easy download and applying of patches, to e.g. aid building a binary program equipped in the plugin.
- A new variable is being recognized by the installation script: `$ZPLG_BIN_DIR_NAME`. It configures the directory
within `$ZPLG_HOME` to which Zplugin should be cloned.
- 09-08-2019
- A new ice-mod `wrap-track''` which gets `;`-separated list of functions that are to be tracked **once** when
executing. In other words you can extend the tracking beyond the moment of loading of a plugin.
- The unloading of Zle widgets is now more smart it takes into account the chains of plugins that can overload the
Zle widgets, and solves the interactions that result out of it.
- 29-07-2019
- `delete` now supports following options:
- `--all` deletes all plugins and snippets (a purge, similar to
`rm -rf ${ZPLGM[PLUGINS_DIR]} ${ZPLGM[SNIPPETS_DIR]}`)
- `--clean` deletes only plugins and snippets that are **currently not loaded** in the current session.
- 09-07-2019
- Zplugin can now have **its own plugins**, called **z-plugins**! Check out an example but fully functional z-plugin
[zdharma/z-p-submods](https://github.com/zdharma/z-p-submods) and a document that explains on how to implement your
own z-plugin ([here](../../wiki/Z-PLUGINS)).
- 08-07-2019
- You can now do `zplugin ice wait ...` and it will work as `zplugin ice wait'0' ...` :) I.e. when there's no value to
the `wait''` ice then a value of `0` is being substituted.
- 02-07-2019
- [Cooperation of Fast-Syntax-Highlighting and Zplugin](https://asciinema.org/a/254630) a new precise highlighting
for Zplugin in F-Sy-H.
- 01-07-2019
- `atclone''`, `atpull''` & `make''` get run in the same subshell, thus an e.g. export done in `atclone''` will be
visible during the `make`.
- 26-06-2019
- `notify''` contents gets evaluated, i.e. can contain active code like `$(tail -1 /var/log/messages)`, etc.
- 23-06-2019
- New ice mod `subscribe''`/`on-update-of''` which works like the `wait''` ice-mod, i.e. defers loading of a plugin,
but it **looks at modification time of the given file(s)**, and when it changes, it then triggers loading of the
plugin/snippet:
```zsh
% zplugin ice on-update-of'{~/files-*,/tmp/files-*}' lucid \
atload"echo I have been loaded" \
notify"Yes that's true :)"
% zplugin load zdharma/null
% touch ~/files-1
The plugin has been loaded
%
Yes that's true :)
```
The plugin/snippet will be sourced as many times as the file gets updated.
- 22-06-2019
- New ice mod `reset-prompt` that will issue `zle .reset-prompt` after loading the plugin or snippet, causing the
prompt to be recomputed. Useful with themes & turbo-mode.
- New ice-mod `notify''` which will cause to display an under-prompt notification when the plugin or snippet gets
loaded. E.g.:
```zsh
% zplugin ice wait"0" lucid notify"zdharma/null has been loaded"
% zplugin light zdharma/null
%
zdharma/null has been loaded
```
In case of problems with the loading a warning message will be output:
```
% zplugin ice notify atload'return 7'
% zplugin light zdharma/null
%
notify: Plugin not loaded / loaded with problem, the return code: 7
```
Refer to [Ice Modifiers](#ice-modifiers) section for a complete description.
- 29-05-2019
- Turbo-Mode, i.e. the `wait''` ice-mode now supports a suffix the letter `a`, `b` or `c`. The meaning is
illustrated by the following example:
```zsh
zplugin ice wait"0b" as"command" pick"wd.sh" atinit"echo Firing 1" lucid
zplugin light mfaerevaag/wd
zplugin ice wait"0a" as"command" pick"wd.sh" atinit"echo Firing 2" lucid
zplugin light mfaerevaag/wd
# The output
Firing 2
Firing 1
```
As it can be seen, the second plugin has been loaded first. That's because there are now three sub-slots (the `a`,
`b` and `c`) in which the plugin/snippet loadings can be put into. Plugins from the same time-slot with suffix `a`
will be loaded before plugins with suffix `b`, etc.
In other words, instead of `wait'1'` you can enter `wait'1a'`, `wait'1b'` and `wait'1c'` to this way **impose
order** on the loadings **regardless of the order of `zplugin` commands**.
- 26-05-2019
- Turbo-Mode now divides the scheduled events (i.e. loadings of plugins or snippets) into packs of 5. In other words,
after loading each series of 5 plugins or snippets the prompt is activated, i.e. it is feed an amount of CPU time.
This will help to deliver the promise of background loading without interferences visible to the user. If you have
some two slow-loading plugins and/or snippets, you can put them into some separate blocks of 5 events.
- 18-05-2019
- New ice-mod `nocd` it prevents changing current directory into the plugin's directory before evaluating
`atinit''`, `atload''` etc. ice-mods.
- 12-03-2019
- Finally reorganizing the `README.md`. Went on asciidoc path, the side-documents are written in it and the
`README.md` will also be converted (example page: [Introduction](doc/INTRODUCTION.adoc))
- 12-10-2018
- New `id-as''` ice-mod. You can nickname a plugin or snippet, to e.g. load it twice, with different `pick''` ice-mod,
or from Github binary releases and regular Github repository at the same time. More information in
[blog post](https://zdharma-continuum.github.io/2018-10-12/Nickname-a-plugin-or-snippet).
- 30-08-2018
- New `as''` ice-mod value: `completion`. Can be used to install completion-only "plugins", even single files:
```zsh
zplugin ice as"completion" mv"hub* -> _hub"
zplugin snippet https://github.com/github/hub/blob/master/etc/hub.zsh_completion
```
- Uplift of Git-output, it now has an animated progress-bar:
![image](https://raw.githubusercontent.com/zdharma/zplugin/images/zplg-progress-bar.gif)
- 15-08-2018
- New `$ZPLGM` field `COMPINIT_OPTS` (also see [Customizing Paths](#customizing-paths--other)). You can pass `-C` or
`-i` there to mute the `insecure directories` messages. Typical use case could be:
```zsh
zplugin ice wait"5" atinit"ZPLGM[COMPINIT_OPTS]=-C; zpcompinit; zpcdreplay" lucid
zplugin light zdharma/fast-syntax-highlighting
```
- 13-08-2018
- `self-update` (subcommand used to update Zplugin) now lists new commits downloaded by the update:
![image](https://raw.githubusercontent.com/zdharma/zplugin/images/zplg-self-update.png)
- New subcommand `bindkeys` that lists what bindkeys each plugin has set up.
- 25-07-2018
- If you encountered a problem with loading Turbo-Mode plugins, it is fixed now. This occurred in versions available
between `10` and `23` of July. Issue `zplugin self-update` if you installed/updated in this period.
- New bug-fix release `v2.07`.
- 13-07-2018
- New `multisrc''` ice, it allows to specify multiple files for sourcing and it uses brace expansion syntax, so for
example you can:
```zsh
zplugin ice depth"1" multisrc="lib/{functions,misc}.zsh" pick"/dev/null"; zplugin load robbyrussell/oh-my-zsh
zplugin ice svn multisrc"{functions,misc}.zsh" pick"/dev/null"; zplugin snippet OMZ::lib
array=( {functions,misc}.zsh ); zplg ice svn multisrc"\${array[@]}" pick"/dev/null"; zplugin snippet OMZ::lib
array=( {functions,misc}.zsh ); zplg ice svn multisrc"${array[@]}" pick"/dev/null"; zplugin snippet OMZ::lib
array=( {functions,misc}.zsh ); zplg ice svn multisrc"\$array" pick"/dev/null"; zplugin snippet OMZ::lib
array=( {functions,misc}.zsh ); zplg ice svn multisrc"$array" pick"/dev/null"; zplugin snippet OMZ::lib
zplugin ice svn multisrc"misc.zsh functions.zsh" pick"/dev/null"; zplugin snippet OMZ::lib
```
- 12-07-2018
- For docker and new machine provisioning, there's a trick that allows to install all
[turbo-mode](#turbo-mode-zsh--53) plugins by scripting:
```zsh
zsh -i -c -- '-zplg-scheduler burst'
```
- 10-07-2018
- Ice `wait'0'` now means actually short time you can load plugins and snippets **very quickly** after prompt.
- 02-03-2018
- Zplugin exports `$ZPFX` parameter. Its default value is `~/.zplugin/polaris` (user can override it before sourcing
Zplugin). This directory is like `/usr/local`, a prefix for installed software, so it's possible to use ice like
`make"PREFIX=$ZPFX"` or `atclone"./configure --prefix=$ZPFX"`. Zplugin also setups `$MANPATH` pointing to the
`polaris` directory. Checkout [gallery](GALLERY.md) for examples.
- [New README section](#hint-extending-git) about extending Git with Zplugin.
- 05-02-2018
- I work much on this README however multi-file Wiki might be better to read it
[just has been created](https://github.com/zdharma/zplugin/wiki).
- 16-01-2018
- New ice-mod `compile` which takes pattern to select additional files to compile, e.g.
`zplugin ice compile"(hsmw-*|history-*)"` (for `zdharma/history-search-multi-word` plugin). See
[Ice Modifiers](#ice-modifiers).
- 14-01-2018
- Two functions have been exposed: `zpcdreplay` and `zpcompinit`. First one invokes compdef-replay, second one is
equal to `autoload compinit; compinit` (it also respects `$ZPLGM[ZCOMPDUMP_PATH]`). You can use e.g.
`atinit'zpcompinit'` ice-mod in a syntax-highlighting plugin, to initialize completion right-before setting up
syntax highlighting (because that should be done at the end).
- 13-01-2018
- New customizable path `$ZPLGM[ZCOMPDUMP_PATH]` that allows to point zplugin to non-standard `.zcompdump` location.
- Tilde-expansion is now performed on the [customizable paths](#customizing-paths--other) you can assign paths like
`~/.zplugin`, there's no need to use `$HOME/.zplugin`.
- 31-12-2017
- For the new year there's a new feature: user-services spawned by Zshell :) Check out
[available services](https://github.com/zservices). They are configured like their READMEs say, and controlled via:
```
% zplugin srv redis next # current serving shell will drop the service, next Zshell will pick it up
% zplugin srv redis quit # the serving shell will quit managing the service, next Zshell will pick it up
% zplugin srv redis stop # stop serving, do not pass it to any shell, just hold the service
% zplugin srv redis start # start stopped service, without changing the serving shell
% zplugin srv redis restart # restart service, without changing the serving shell
```
This feature allows to configure everything in `.zshrc`, without the the need to deal with `systemd` or `launchd`,
and can be useful e.g. to configure shared-variables (across Zshells), stored in `redis` database (details on
[zservices/redis](https://github.com/zservices/redis)).
- 24-12-2017
- Xmas present [fast-syntax-highlighting](https://github.com/zdharma/fast-syntax-highlighting) now highlights the
quoted part in `atinit"echo Initializing"`, i.e. it supports ICE syntax :)
- 08-12-2017
- SVN snippets are compiled on install and update
- Resolved how should ice-mods be remembered general rule is that using `zplugin ice ...` makes memory-saved and
disk-saved ice-mods not used, and replaced on update. Calling e.g. `zplugin update ...` without preceding `ice` uses
memory, then disk-saved ices.
- 07-12-2017
- New subcommand `delete` that obtains plugin-spec or URL and deletes plugin or snippet from disk. It's good to forget
wrongly passed Ice-mods (which are storred on disk e.g. for `update --all`).
- 04-12-2017
- It's possible to set plugin loading and unloading on condition. ZPlugin supports plugin unloading, so it's possible
to e.g. **unload prompt and load another one**, on e.g. directory change. Checkout
[full story](#automatic-loadunload-on-condition) and [Asciinema video](https://asciinema.org/a/150825).
- 29-11-2017
- **[Turbo Mode](https://github.com/zdharma/zplugin#turbo-mode-zsh--53)** **39-50% or more faster Zsh startup!**
- Subcommand `update` can update snippets, via given URL (up to this point snippets were updated via
`zplugin update --all`).
- Completion management is enabled for snippets (not only plugins).
- 13-11-2017
- New ice modifier `make`. It causes the `make`-command to be executed after cloning or updating plugins and
snippets. For example there's `Zshelldoc` that uses `Makefile` to build final scripts:
```SystemVerilog
zplugin ice as"program" pick"build/zsd*" make; zplugin light zdharma/zshelldoc
```
The above doesn't trigger the `install` target, but this does:
```SystemVerilog
zplugin ice as"program" pick"build/zsd*" make"install PREFIX=/tmp"; zplugin light zdharma/zshelldoc
```
- Fixed problem with binary-release selection (`from"gh-r"`) by adding Ice-mod `bpick`, which should be used for this
purpose instead of `pick`, which selects file within plugin tree.
- 06-11-2017
- The subcommand `completions` now prints `3` completions per line (not `1`). This makes large amount of completions to look
better. Argument can be given, e.g. `6`, to increase the grouping.
- New Ice-mod `silent` that mutes `stderr` & `stdout` of a plugin or snippet.
- 04-11-2017
- New subcommand `ls` which lists snippets-directory in a formatted and colorized manner. Example:
![zplugin-ls](https://raw.githubusercontent.com/zdharma/zplugin/images/zplg-ls.png)
- 29-10-2017
- Subversion protocol (supported by Github) can be used to clone **subdirectories** when using snippets. This allows
to load multi-file snippets. For example:
```SystemVerilog
zstyle ':prezto:module:prompt' theme smiley
zplugin ice svn silent; zplugin snippet PZT::modules/prompt
```
- Snippets support `Prezto` modules (with dependencies), and can use **PZT::** URL-shorthand, like in the example
above. One can load `Prezto` module as single file snippet, or use Subversion to download whole directory (see also
description of [Ice Modifiers](#ice-modifiers)):
```zsh
# Single file snippet, URL points to file
zplg snippet PZT::modules/helper/init.zsh
# Multi-file snippet, URL points to directory to clone with Subversion
# The file to source (init.zsh) is automatically detected
zplugin ice svn; zplugin snippet PZT::modules/prompt
# Use of Subversion to load an OMZ plugin
zplugin ice svn; zplugin snippet OMZ::plugins/git
```
- Fixed a bug with `cURL` usage (snippets) for downloading, it will now be properly used
- 13-10-2017
- Snippets can use "**OMZ::**" prefix to easily point to `Oh-My-Zsh` plugins and libraries, e.g.:
```SystemVerilog
zplugin snippet OMZ::lib/git.zsh
zplugin snippet OMZ::plugins/git/git.plugin.zsh
```
- 12-10-2017
- The `cd` subcommand can now obtain URL and move session to **snippet** directory
- The `times` subcommand now includes statistics on snippets. Also, entries are displayed in order of loading:
```zsh
% zplugin times
Plugin loading times:
0.010 sec - OMZ::lib/git.zsh
0.001 sec - OMZ::plugins/git/git.plugin.zsh
0.003 sec - zdharma/history-search-multi-word
0.003 sec - rimraf/k
0.003 sec - zsh-users/zsh-autosuggestions
```
- 24-09-2017
- **[Code documentation](zsdoc)** for contributors and interested people.
- 13-06-2017
- Plugins can now be absolute paths:
```SystemVerilog
zplugin load %HOME/github/{directory}
zplugin load /Users/sgniazdowski/github/{directory}
zplugin load %/Users/sgniazdowski/github/{directory}
```
Completions are not automatically installed, but user can run `zplg creinstall %HOME/github/{directory}`, etc.
- 23-05-2017
- New `ice` modifier: `if`, to which you can provide a conditional expression:
```SystemVerilog
% zplugin ice if"(( 0 ))"
% zplugin snippet --command https://github.com/b4b4r07/httpstat/blob/master/httpstat.sh
% zplugin ice if"(( 1 ))"
% zplugin snippet --command https://github.com/b4b4r07/httpstat/blob/master/httpstat.sh
Setting up snippet httpstat.sh
Downloading httpstat.sh...
```

View file

@ -1,138 +0,0 @@
# HACKING.md
## Documentation
### README: Update the table of contents
1. Install [doctoc](https://github.com/thlorenz/doctoc)
2. To update the TOC, run the following command:
```zsh
doctoc --github README.md
```
### Update asciidoc and/or zshelldoc
> [!IMPORTANT]
> Make sure you have [docker](https://www.docker.com/) or [podman](https://podman.io/) installed.
1. From the root of the repo, run:
```zsh
make doc-container
```
If, for some reason, you want to build the zshelldocs or the PDF manually, you'll need:
1. Patience, zsd is very finicky about locales. You have been warned.
2. [zshelldoc (zsd)](https://github.com/zdharma-continuum/zshelldoc)
3. [asciidoc](https://asciidoc.org/)
4. `make doc`
### Generate the manpage (doc/zinit.1)
1. Install [pandoc](https://pandoc.org/)
2. From the root of the repo run:
```zsh
pandoc --standalone --to man README.md -o doc/zinit.1
```
### Updating the gh-pages (zdharma-continuum.github.io)
1. Check out the [documentation branch](https://github.com/zdharma-continuum/zinit/tree/documentation)
```shell
git fetch origin documentation
git checkout documentation
```
2. Do your modifications and push your changes
3. Keep an eye on [the CI logs](https://github.com/zdharma-continuum/zinit/actions/workflows/gh-pages.yaml)
4. If all went well, head to https://zdharma-continuum.github.io/ to see your changes live.
> [!NOTE]
> If you really **need** to push directly, without CI, please refer to [the README in the
documentation](https://github.com/zdharma-continuum/zinit/blob/documentation/README.md)
## Testing
We run our tests with [zunit](https://zunit.xyz).
To add a new test case:
1. Install [zunit](https://zunit.xyz) and [revolver](https://github.com/molovo/revolver):
```zsh
zinit for \
as"program" \
atclone"ln -sfv revolver.zsh-completion _revolver" \
atpull"%atclone" \
pick"revolver" \
@molovo/revolver \
as"completion" \
atclone"./build.zsh; ln -sfv zunit.zsh-completion _zunit" \
atpull"%atclone" \
sbin"zunit" \
@zunit-zsh/zunit
```
2. Create a new `.zunit` file in the `tests/` dir. Here's a template:
```zsh
#!/usr/bin/env zunit
@setup {
load setup
setup
}
@teardown {
load teardown
teardown
}
@test 'zinit-annex-bin-gem-node installation' {
# This spawns the official zinit container and executes a single zinit command
# inside it
run ./scripts/docker-run.sh --wrap --debug --zunit \
zinit light as"null" for zdharma-continuum/null
# Verify the exit code of the command above
assert $state equals 0
assert "$output" contains "Downloading"
local artifact="${PLUGINS_DIR}/zdharma-continuum---null/readme.md"
# Check if we downloaded the file correctly and if it is readable
assert "$artifact" is_file
assert "$artifact" is_readable
}
```
You should, of course, also check out the existing tests ;)
3. To run your new test:
```zsh
zunit --verbose tests/your_test.zunit
```
### Debugging tests
If you ever need to inspect the `ZINIT[HOME_DIR]` dir, where zinit's internal data is stored, you can do so by commenting
out the `@teardown` section in your test. Then you can re-run said test and head over to `${TMPDIR:-/tmp}/zunit-zinit`.
Good luck!
## Misc
### Get the list of supported ices
To get the list in a quick-and-dirty fashion, you issue:
```zsh
zinit --help | tail -1
```
See
[zinit-autoload.zsh](https://github.com/zdharma-continuum/zinit/blob/2feb41cf70d2f782386bbaa6fda691e3bdc7f1ac/zinit-autoload.zsh#L3445-L3447)
for implementation details.

72
doc/INSTALLATION.adoc Normal file
View file

@ -0,0 +1,72 @@
# INSTALLATION OF ZPLUGIN
Sebastian Gniazdowski <psprint@zdharma.org>
v0.9, 12/03/2018
:source-highlighter: prettify
:toc:
:toclevels: 3
:toc-placement!:
toc::[]
## Installation
Execute:
```sh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zplugin/master/doc/install.sh)"
```
To update run the command again (or just execute `doc/install.sh`) or run `zplugin self-update`.
`Zplugin` will be installed into `~/.zplugin/bin`. `.zshrc` will be updated with
three lines of code that will be added to the bottom (the lines will be sourcing
`zplugin.zsh` and setting up completion).
Completion will be available, for command **zplugin** and aliases **zpl**, **zplg**.
After installing and reloading shell give `Zplugin` a quick try with `zplugin help`
and compile it with `zplugin self-update`.
### Manual Installation
To manually install `Zplugin` clone the repo to e.g. `~/.zplugin/bin`:
```sh
mkdir ~/.zplugin
git clone https://github.com/zdharma/zplugin.git ~/.zplugin/bin
```
and source it from `.zshrc` (**above compinit**):
```sh
source ~/.zplugin/bin/zplugin.zsh
```
If you place the `source` below `compinit`, then add those two lines after the `source`:
```sh
autoload -Uz _zplugin
(( ${+_comps} )) && _comps[zplugin]=_zplugin
```
Various paths can be customized, see the README's section link:../README.md#customizing-paths\--other[Customizing Paths].
After installing and reloading shell give `Zplugin` a quick try with `zplugin help` and
compile it with `zplugin self-update`.
## Compilation
It's good to compile `zplugin` into `Zsh` bytecode:
```sh
zcompile ~/.zplugin/bin/zplugin.zsh
```
**NEW:** `zplugin self-update` now also performs full zplugin compilation on each run.
Zplugin will compile each newly downloaded plugin. You can clear compilation of
a plugin by invoking `zplugin uncompile {plugin-spec}`. There are also commands
`compile`, `compiled` that control the functionality of compiling plugins.
[appendix]
== Revision history (history of updates to the document)
v1.01, 03/13/2018: Update the link to README.md / Customizing Paths section +
v1.00, 03/11/2018: First asciidoc version 1/ replaced doctoc with :toc: 2/ Intense uplift and verification before commiting +

326
doc/INTRODUCTION.adoc Normal file
View file

@ -0,0 +1,326 @@
# INTRODUCTION TO ZPLUGIN
Sebastian Gniazdowski <psprint@zdharma.org>
v0.9, 12/03/2018
:source-highlighter: prettify
:toc:
:toclevels: 3
:toc-placement!:
in the document below you'll find out how to:
- use Oh-My-Zsh and Prezto,
- manage completions,
- use the Turbo Mode,
- use the ice-mods like `as"program"`,
and much more.
toc::[]
## Introduction
**Example use:**
```SystemVerilog
% zplugin load zdharma/history-search-multi-word
% zplugin light zsh-users/zsh-syntax-highlighting
```
Above commands show two ways of basic plugin loading. **load** causes reporting
to be enabled you can track what plugin does, view the information with
`zplugin report {plugin-spec}`. **light** is a significantly faster loading
without tracking and reporting (note: plugin-unloading needs the tracking; also
note: **in turbo mode the slowdown caused by tracking is neglectable).**
### Oh-My-Zsh, Prezto
To load Oh-My-Zsh and Prezto plugins, use `snippet` feature. Snippets are single
files downloaded by `curl`, `wget`, etc. directly from URL. For example:
```SystemVerilog
% zplugin snippet 'https://github.com/robbyrussell/oh-my-zsh/raw/master/plugins/git/git.plugin.zsh'
% zplugin snippet 'https://github.com/sorin-ionescu/prezto/blob/master/modules/helper/init.zsh'
```
Also, you can use `OMZ::` and `PZT::` shorthands:
```SystemVerilog
% zplugin snippet OMZ::plugins/git/git.plugin.zsh
% zplugin snippet PZT::modules/helper/init.zsh
```
Moreover, snippets support `Subversion` protocol, supported also by Github.
This allows to load snippets that are multi-file (for example a Prezto module
can have file `init.zsh` and file `alias.zsh`). Default files that will be
sourced are: `*.plugin.zsh`, `init.zsh`, `*.zsh-theme`:
```SystemVerilog
# URL points to directory
% zplugin ice svn; zplugin snippet PZT::modules/docker
```
### Snippets and performance
Using `curl`, `wget`, etc., `Subversion` allows to almost completely avoid code
dedicated to Oh-My-Zsh and Prezto, and also to other frameworks. This gives
profits in performance of `Zplugin`, it is really fast and also compact (low
memory usage, short loading time).
### Some Ice-modifiers
The command `zplugin ice` provides Ice-modifiers for single next command (see
the README subsection
link:https://github.com/zdharma/zplugin#ice-modifiers[ice-modifiers]). The logic
is that "ice" is something that melts (so it doesn't last long) and something
that's added (e.g. to a drink or a coffee). Using other Ice-modifier "**pick**"
user can explicitly select the file to source:
```SystemVerilog
% zplugin ice svn pick"init.zsh"; zplugin snippet PZT::modules/git
```
Content of Ice-modifier is simply put into `"..."`, `'...'`, or `$'...'`. No
need for `":"` after Ice-mod name. This way editors like `vim` and `emacs` will
highlight contents of Ice-modifiers.
### as"program"
A plugin might not be a file for sourcing, but a command to be added to `$PATH`.
To obtain this effect, use Ice-modifier `as` with value `program`.
```SystemVerilog
% zplugin ice as"program" cp"httpstat.sh -> httpstat" pick"httpstat"
% zplugin light b4b4r07/httpstat
```
Above command will add plugin directory to `$PATH`, copy file `httpstat.sh` into
`httpstat` and add execution rights (`+x`) to the file selected with `pick`,
i.e. to `httpstat`. Other Ice-mod exists, `mv`, which works like `cp` but
**moves** a file instead of **copying** it. `mv` is ran before `cp`.
### atpull"..."
Copying file is safe for doing later updates  original files of repository are
unmodified and `Git` will report no conflicts. However, `mv` also can be used,
if a proper `atpull` (an Icemodifier ran at **update** of plugin) will be used:
```SystemVerilog
% zplugin ice as"program" mv"httpstat.sh -> httpstat" pick"httpstat" atpull'!git reset --hard'
% zplugin light b4b4r07/httpstat
```
If `atpull` starts with exclamation mark, then it will be run before `git pull`,
and before `mv`. Nevertheless, `atpull`, `mv`, `cp` are ran **only if new
commits are to be fetched**. So in summary, when user runs `zplugin update
b4b4r07/httpstat` to update this plugin, and there are new commits, what happens
first is that `git reset --hard` is ran and it restores original
`httpstat.sh`, **then** `git pull` is ran and it downloads new commits (doing
fast-forward), **then** `mv` is ran again so that the command is `httpstat` not
`httpstat.sh`.
For exclamation mark to not be expanded by Zsh in interactive session, use
`'...'` not `"..."` to enclose contents of `atpull` Ice-mod.
### Snippets-commands
Commands can also be added to `$PATH` using **snippets**. For example:
```SystemVerilog
% zplugin ice mv"httpstat.sh -> httpstat" pick"httpstat" as"program"
% zplugin snippet https://github.com/b4b4r07/httpstat/blob/master/httpstat.sh
```
Snippets also support `atpull` Ice-mod, so it's possible to do e.g. `atpull'!svn
revert'`. There's also `atinit` Ice-mod, executed before loading plugin or
snippet (but after setting up its main directory).
### Snippets-completions
By using the `as''` ice-mod with value `completion` you can point the `snippet`
subcommand directly to the completion file, e.g.:
```SystemVerilog
zplugin ice as"completion"
zplugin snippet https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker
```
### Completion Management
Zplugin allows to disable and enable each completion in every plugin. Try
installing a popular plugin that provides completions:
```SystemVerilog
% zplugin ice blockf
% zplugin light zsh-users/zsh-completions
```
First command will block the traditional method of adding completions. Zplugin
uses own method (based on symlinks instead of adding to `$fpath`). Zplugin will
automatically *install* completions of newly downloaded plugin. To uninstall,
and install again, use
```SystemVerilog
% zplg cuninstall zsh-users/zsh-completions # uninstall
% zplg creinstall zsh-users/zsh-completions # install
```
#### Listing completions
(Note: `zplg` is an alias that can be used in interactive sessions). To see what
completions *all* plugins provide, in tabular formatting and with name of each
plugin, use:
```SystemVerilog
% zplg clist
```
This command is specially adapted for plugins like `zsh-users/zsh-completions`,
which provide many completions listing will have `3` completions per line, so
that not many terminal pages will be occupied, like this:
```SystemVerilog
...
atach, bitcoin-cli, bower zsh-users/zsh-completions
bundle, caffeinate, cap zsh-users/zsh-completions
cask, cf, chattr zsh-users/zsh-completions
...
```
You can show more completions per line by providing an *argument* to `clist`,
e.g. `zplg clist 6`, will show:
```SystemVerilog
...
bundle, caffeinate, cap, cask, cf, chattr zsh-users/zsh-completions
cheat, choc, cmake, coffee, column, composer zsh-users/zsh-completions
console, dad, debuild, dget, dhcpcd, diana zsh-users/zsh-completions
...
```
#### Enabling and disabling completions
Completions can be disabled, so that e.g. original Zsh completion will be used.
The commands are very basic, they only need completion *name*:
```
% zplg cdisable cmake
Disabled cmake completion belonging to zsh-users/zsh-completions
% zplg cenable cmake
Enabled cmake completion belonging to zsh-users/zsh-completions
```
That's all on completions. There's one more command, `zplugin csearch`, that
will *search* all plugin directories for available completions, and show if they
are installed. This sums up to complete control over completions.
### Subversion For Subdirectories
In general, to use *subdirectories* of Github projects as snippets add
`/trunk/{path-to-dir}` to URL, for example:
```SystemVerilog
% zplugin ice svn; zplugin snippet https://github.com/zsh-users/zsh-completions/trunk/src
# For Oh-My-Zsh and Prezto, the OMZ:: and PZT:: prefixes work
# without the need to add the `/trunk/` infix (however the path
# should point to a directory, not to a file):
% zplugin ice svn; zplugin snippet PZT::modules/docker
```
Snippets too have completions installed by default, like plugins.
### Turbo Mode (Zsh >= 5.3)
The Ice-mod `wait` allows you to postpone loading of a plugin to the moment when
processing of `.zshrc` is finished and prompt is being shown. It is like Windows
during startup, it shows desktop even though it still loads data in
background. This has drawbacks, but is for sure better than blank screen for 10
minutes. And here, in Zplugin, there are no drawbacks of this approach no
lags, freezes, etc.  the command line is fully usable while the plugins are
being loaded, for number of such plugins like `10` or `20`. For higher number of
plugins automatic queueing for next free time slot (i.e. delaying) is performed.
Zsh 5.3 or greater is required. To use this Turbo Mode add `wait` ice to the
target plugin in one of following ways:
```SystemVerilog
PS1="READY > "
zplugin ice wait'!0' atload'promptinit; prompt scala3'
zplugin load psprint/zprompts
```
This sets plugin `psprint/zprompts` to be loaded `0` seconds after `zshrc`. It
will fire up after c.a. 100 ms of showing of the basic prompt `READY >`. I've
started to use this method of setting up a prompt a year ago now and I run it
without any problems.
The exclamation mark causes Zplugin to reset-prompt after loading plugin. The
same with Prezto prompts, with a longer delay:
```SystemVerilog
zplg ice svn silent wait'!1' atload'prompt smiley'
zplg snippet PZT::modules/prompt
```
Using `zsh-users/zsh-autosuggestions` without any drawbacks:
```SystemVerilog
zplugin ice wait'1' atload'_zsh_autosuggest_start'
zplugin light zsh-users/zsh-autosuggestions
```
Autosuggestions uses `precmd` hook that is called right after processing `zshrc`
(before prompt). Turbo Mode will wait `1` second so `precmd` will not be called
at first prompt. This makes autosuggestions inactive at first prompt.
**However** the given `atload` Ice-mod fixes this, it calls the same function
`precmd` would, right after loading autosuggestions.
```SystemVerilog
zplugin ice wait'[[ -n ${ZLAST_COMMANDS[(r)cras*]} ]]'
zplugin load zdharma/zplugin-crasis
```
The plugin `zplugin-crasis` provides command `crasis`. Ice-mod `wait` is set to
wait on condition. When user enters `cras` at command line, the plugin is
instantly loaded and command `crasis` becomes available. **
link:https://asciinema.org/a/149725[See this feature in action] **. This feature
requires `zdharma/fast-syntax-highlighting` (it builds the `ZLAST_COMMANDS`
array).
#### Automatic Load/Unload On Condition
Ices `load` and `unload` allow to define when you want plugins active or
unactive. For example:
```SystemVerilog
# Load when in ~/tmp
zplugin ice load'![[ $PWD = */tmp ]]' unload'![[ $PWD != */tmp ]]' atload"promptinit; prompt sprint3"
zplugin load psprint/zprompts
# Load when NOT in ~/tmp
zplugin ice load'![[ $PWD != */tmp ]]' unload'![[ $PWD = */tmp ]]'
zplugin load russjohnson/angry-fly-zsh
```
Two prompts, each active in different directories. This can be used to have
plugin-sets, e.g. by defining parameter `$PLUGINS` with possible values like
`cpp`,`web`,`admin` and by setting `load`/`unload` conditions to activate
different plugins on `cpp`, on `web`, etc.
The difference with `wait` is that `load`/`unload` are constantly active, not only
till first activation.
Note that unloading a plugin needs it to be loaded with tracking (so `zplugin
load ...`, not `zplugin light ...`). Tracking causes slight slowdown, however
this doesn't matter in turbo mode, as Zsh startup isn't slowed down.
**See also Wiki on
link:https://github.com/zdharma/zplugin/wiki/Multiple-prompts[multiple prompts].**
[appendix]
== Revision history (history of updates to the document)
v0.92, 05/19/2018: 1/ Precise uplift 2/ added the Snippets-completions section +
v0.9, 03/11/2018: First asciidoc version 1/ replaced doctoc with :toc: 2/ general,
intense uplift before commiting +

357
doc/db/emulksh_options.txt Normal file
View file

@ -0,0 +1,357 @@
zsh-5.0.8, OS X 10.11.2
non-interactive zsh, emulate zsh:
noaliases off
allexport off
noalwayslastprompt off
alwaystoend off
noappendhistory off
autocd off
autocontinue off
noautolist off
noautomenu off
autonamedirs off
noautoparamkeys off
noautoparamslash off
autopushd off
noautoremoveslash off
autoresume off
nobadpattern off
nobanghist off
nobareglobqual off
bashautolist off
bashrematch off
nobeep off
nobgnice off
braceccl off
bsdecho off
nocaseglob off
nocasematch off
cbases off
cdablevars off
chasedots off
chaselinks off
nocheckjobs off
noclobber off
combiningchars off
completealiases off
completeinword off
continueonerror off
correct off
correctall off
cprecedences off
cshjunkiehistory off
cshjunkieloops off
cshjunkiequotes off
cshnullcmd off
cshnullglob off
nodebugbeforecmd off
dvorak off
emacs off
noequals off
errexit off
errreturn off
noevallineno off
noexec off
extendedglob off
extendedhistory off
noflowcontrol off
forcefloat off
nofunctionargzero off
noglob off
noglobalexport off
noglobalrcs off
globassign off
globcomplete off
globdots off
globsubst off
nohashcmds off
nohashdirs on
hashexecutablesonly off
nohashlistall off
histallowclobber off
nohistbeep off
histexpiredupsfirst off
histfcntllock off
histfindnodups off
histignorealldups off
histignoredups off
histignorespace off
histlexwords off
histnofunctions off
histnostore off
histreduceblanks off
nohistsavebycopy off
histsavenodups off
histsubstpattern off
histverify off
nohup off
ignorebraces off
ignoreclosebraces off
ignoreeof off
incappendhistory off
incappendhistorytime off
interactive off
interactivecomments off
ksharrays off
kshautoload off
kshglob off
kshoptionprint on
kshtypeset off
kshzerosubscript off
nolistambiguous off
nolistbeep off
listpacked off
listrowsfirst off
nolisttypes off
localloops off
localoptions off
localpatterns off
localtraps off
login off
longlistjobs off
magicequalsubst off
mailwarning off
markdirs off
menucomplete off
monitor off
nomultibyte off
nomultifuncdef off
nomultios off
nonomatch off
nonotify off
nullglob off
numericglobsort off
octalzeroes off
overstrike off
pathdirs off
pathscript off
pipefail off
posixaliases off
posixargzero off
posixbuiltins off
posixcd off
posixidentifiers off
posixjobs off
posixstrings off
posixtraps off
printeightbit off
printexitvalue off
privileged off
promptbang off
nopromptcr off
nopromptpercent off
nopromptsp off
promptsubst off
pushdignoredups off
pushdminus off
pushdsilent off
pushdtohome off
rcexpandparam off
rcquotes off
norcs off
recexact off
rematchpcre off
restricted off
rmstarsilent off
rmstarwait off
sharehistory off
shfileexpansion off
shglob off
shinstdin off
shnullcmd off
shoptionletters off
noshortloops off
shwordsplit off
singlecommand off
singlelinezle off
sourcetrace off
sunkeyboardhack off
transientrprompt off
trapsasync off
typesetsilent off
nounset off
verbose off
vi off
warncreateglobal off
xtrace off
zle off
non-interactive zsh, emulate ksh:
noaliases off
allexport off
noalwayslastprompt off
alwaystoend off
noappendhistory off
autocd off
autocontinue off
noautolist off
noautomenu off
autonamedirs off
noautoparamkeys off
noautoparamslash off
autopushd off
noautoremoveslash off
autoresume off
badpattern off
banghist on
bareglobqual off
bashautolist off
bashrematch off
nobeep off
bgnice off
braceccl off
bsdecho off
nocaseglob off
nocasematch off
cbases off
cdablevars off
chasedots off
chaselinks off
checkjobs off
noclobber off
combiningchars off
completealiases off
completeinword off
continueonerror off
correct off
correctall off
nocprecedences off
cshjunkiehistory off
cshjunkieloops off
cshjunkiequotes off
cshnullcmd off
cshnullglob off
nodebugbeforecmd off
dvorak off
emacs off
equals off
errexit off
errreturn off
evallineno off
noexec off
extendedglob off
extendedhistory off
noflowcontrol off
forcefloat off
functionargzero off
noglob off
globalexport off
noglobalrcs off
globassign off
globcomplete off
globdots off
noglobsubst off
nohashcmds off
nohashdirs on
hashexecutablesonly off
nohashlistall off
histallowclobber off
nohistbeep off
histexpiredupsfirst off
histfcntllock off
histfindnodups off
histignorealldups off
histignoredups off
histignorespace off
histlexwords off
histnofunctions off
histnostore off
histreduceblanks off
nohistsavebycopy off
histsavenodups off
histsubstpattern off
histverify off
hup off
ignorebraces off
ignoreclosebraces off
ignoreeof off
incappendhistory off
incappendhistorytime off
interactive off
nointeractivecomments on
noksharrays off
nokshautoload off
nokshglob off
nokshoptionprint off
nokshtypeset off
kshzerosubscript off
nolistambiguous off
nolistbeep off
listpacked off
listrowsfirst off
nolisttypes off
localloops off
nolocaloptions off
localpatterns off
nolocaltraps off
login off
longlistjobs off
magicequalsubst off
mailwarning off
markdirs off
menucomplete off
monitor off
nomultibyte off
multifuncdef off
multios off
nomatch off
notify on
nullglob off
numericglobsort off
octalzeroes off
overstrike off
pathdirs off
nopathscript off
pipefail off
noposixaliases off
posixargzero off
noposixbuiltins off
noposixcd off
noposixidentifiers off
noposixjobs off
noposixstrings off
noposixtraps off
printeightbit off
printexitvalue off
privileged off
nopromptbang on
nopromptcr off
promptpercent on
nopromptsp off
nopromptsubst on
pushdignoredups off
pushdminus off
pushdsilent off
pushdtohome off
rcexpandparam off
rcquotes off
norcs off
recexact off
rematchpcre off
restricted off
normstarsilent on
rmstarwait off
nosharehistory on
noshfileexpansion off
noshglob off
shinstdin off
noshnullcmd off
noshoptionletters off
shortloops off
noshwordsplit off
singlecommand off
nosinglelinezle on
sourcetrace off
sunkeyboardhack off
transientrprompt off
trapsasync off
notypesetsilent off
nounset off
verbose off
vi off
warncreateglobal off
xtrace off
zle off

50
doc/db/flags.txt Normal file
View file

@ -0,0 +1,50 @@
echo ${(<TAB>, zsh-5.0.8, OS X 10.11.2
parameter flag
# -- evaluate as numeric expression
% -- expand prompt sequences
0 -- split words on null bytes
@ -- double-quoted splitting of scalars
A -- create array parameter
B -- include index of beginning of match in #, %, / expressions
C -- capitalize words
D -- perform directory name abbreviation
E -- include index of end of match in #, %, / expressions
F -- join arrays with newlines
I -- search <argument>th match in #, %, / expressions
L -- lower case all letters
M -- include matched portion in #, %, / expressions
N -- include length of match in #, % expressions
O -- sort in descending order (lexically if no other sort option)
P -- use parameter value as name of parameter for redirected lookup
Q -- remove one level of quoting
R -- include rest (unmatched portion) in #, %, / expressions
S -- search substrings in #, %, / expressions
U -- upper case all letters
V -- visibility enhancements for special characters
W -- count words including empty words (with ${(W)#...})
X -- report parsing errors and eXit substitution
Z -- split words as if zsh command line (with options)
a -- sort in array index order (with O to reverse)
b -- backslash quote pattern characters only
c -- count characters in an array (with ${(c)#...})
e -- perform single-word shell expansions
f -- split the result on newlines
g -- process echo array sequences (needs options)
i -- sort case-insensitively
j -- join arrays with specified string
k -- subsitute keys of associative arrays
l -- left-pad resulting words
m -- count multibyte width in padding calculation
n -- sort decimal integers numerically
o -- sort in ascending order (lexically if no other sort option)
p -- handle print escapes or variables in parameter flag arguments
q -- quote with backslashes
r -- right-pad resulting words
s -- split words on specified string
t -- substitute type of parameter
u -- substitute first occurrence of each unique word
v -- substitute values of associative arrays (with (k))
w -- count words in array or string (with ${(w)#...})
z -- split words as if zsh command line
~ -- treat strings in parameter flag arguments as patterns

357
doc/db/options.txt Normal file
View file

@ -0,0 +1,357 @@
Remembered state of Zsh during loading of a sophisticated plugin first
with no problem second one with slight (extendedglob) recognized problem
RESULT: prefix ||, option/MATCH: |noksharrays|
noaliases off
allexport off
noalwayslastprompt off
alwaystoend off
noappendhistory off
autocd on
autocontinue off
noautolist off
noautomenu on
autonamedirs off
noautoparamkeys off
noautoparamslash off
autopushd on
noautoremoveslash off
autoresume off
nobadpattern off
nobanghist off
nobareglobqual off
bashautolist off
bashrematch off
nobeep off
nobgnice off
braceccl off
bsdecho off
nocaseglob off
nocasematch off
cbases on
cdablevars off
chasedots off
chaselinks off
nocheckjobs off
noclobber off
combiningchars off
completealiases off
completeinword on
continueonerror off
correct off
correctall off
cprecedences off
cshjunkiehistory off
cshjunkieloops off
cshjunkiequotes off
cshnullcmd off
cshnullglob off
nodebugbeforecmd off
dvorak off
emacs off
noequals off
errexit off
errreturn off
noevallineno off
noexec off
extendedglob on
extendedhistory off
noflowcontrol off
forcefloat off
nofunctionargzero off
noglob off
noglobalexport off
noglobalrcs off
globassign off
globcomplete off
globdots off
globsubst off
nohashcmds off
nohashdirs off
hashexecutablesonly off
nohashlistall off
histallowclobber off
nohistbeep off
histexpiredupsfirst off
histfcntllock off
histfindnodups off
histignorealldups off
histignoredups on
histignorespace off
histlexwords off
histnofunctions off
histnostore off
histreduceblanks off
nohistsavebycopy off
histsavenodups off
histsubstpattern off
histverify off
nohup off
ignorebraces off
ignoreclosebraces off
ignoreeof on
incappendhistory on
incappendhistorytime off
interactive on
interactivecomments on
ksharrays off
kshautoload off
kshglob off
kshoptionprint on
kshtypeset off
kshzerosubscript off
nolistambiguous off
nolistbeep off
listpacked on
listrowsfirst off
nolisttypes off
localloops off
localoptions off
localpatterns off
localtraps off
login off
longlistjobs off
magicequalsubst off
mailwarning off
markdirs off
menucomplete off
monitor on
nomultibyte off
nomultifuncdef off
nomultios off
nonomatch off
nonotify off
nullglob off
numericglobsort on
octalzeroes on
overstrike off
pathdirs off
pathscript off
pipefail off
posixaliases off
posixargzero off
posixbuiltins off
posixcd off
posixidentifiers off
posixjobs off
posixstrings off
posixtraps off
printeightbit off
printexitvalue off
privileged off
promptbang off
nopromptcr on
nopromptpercent off
nopromptsp off
promptsubst on
pushdignoredups on
pushdminus off
pushdsilent off
pushdtohome off
rcexpandparam off
rcquotes off
norcs off
recexact off
rematchpcre off
restricted off
rmstarsilent off
rmstarwait off
sharehistory off
shfileexpansion off
shglob off
shinstdin on
shnullcmd off
shoptionletters off
noshortloops off
shwordsplit off
singlecommand off
singlelinezle off
sourcetrace off
sunkeyboardhack off
transientrprompt off
trapsasync off
typesetsilent off
nounset off
verbose off
vi off
warncreateglobal off
xtrace off
zle on
RESULT: prefix |localoptions|, option/MATCH: ||
noaliases off
allexport off
noalwayslastprompt off
alwaystoend off
noappendhistory off
autocd off
autocontinue off
noautolist off
noautomenu on
autonamedirs off
noautoparamkeys off
noautoparamslash off
autopushd on
noautoremoveslash off
autoresume off
nobadpattern off
nobanghist off
nobareglobqual off
bashautolist off
bashrematch off
nobeep off
nobgnice off
braceccl off
bsdecho off
nocaseglob off
nocasematch off
cbases on
cdablevars off
chasedots off
chaselinks off
nocheckjobs off
noclobber off
combiningchars off
completealiases off
completeinword on
continueonerror off
correct off
correctall off
cprecedences off
cshjunkiehistory off
cshjunkieloops off
cshjunkiequotes off
cshnullcmd off
cshnullglob off
nodebugbeforecmd off
dvorak off
emacs off
noequals off
errexit off
errreturn off
noevallineno off
noexec off
extendedglob off
extendedhistory off
noflowcontrol off
forcefloat off
nofunctionargzero off
noglob off
noglobalexport off
noglobalrcs off
globassign off
globcomplete off
globdots off
globsubst off
nohashcmds off
nohashdirs off
hashexecutablesonly off
nohashlistall off
histallowclobber off
nohistbeep off
histexpiredupsfirst off
histfcntllock off
histfindnodups off
histignorealldups off
histignoredups on
histignorespace off
histlexwords off
histnofunctions off
histnostore off
histreduceblanks off
nohistsavebycopy off
histsavenodups off
histsubstpattern off
histverify off
nohup off
ignorebraces off
ignoreclosebraces off
ignoreeof on
incappendhistory on
incappendhistorytime off
interactive on
interactivecomments on
ksharrays off
kshautoload off
kshglob off
kshoptionprint on
kshtypeset off
kshzerosubscript off
nolistambiguous off
nolistbeep off
listpacked on
listrowsfirst off
nolisttypes off
localloops off
localoptions on
localpatterns on
localtraps on
login off
longlistjobs off
magicequalsubst off
mailwarning off
markdirs off
menucomplete off
monitor on
nomultibyte off
nomultifuncdef off
nomultios off
nonomatch off
nonotify off
nullglob off
numericglobsort off
octalzeroes off
overstrike off
pathdirs off
pathscript off
pipefail off
posixaliases off
posixargzero off
posixbuiltins off
posixcd off
posixidentifiers off
posixjobs off
posixstrings off
posixtraps off
printeightbit off
printexitvalue off
privileged off
promptbang off
nopromptcr on
nopromptpercent off
nopromptsp off
promptsubst on
pushdignoredups off
pushdminus off
pushdsilent off
pushdtohome off
rcexpandparam off
rcquotes off
norcs off
recexact off
rematchpcre off
restricted off
rmstarsilent off
rmstarwait off
sharehistory off
shfileexpansion off
shglob off
shinstdin on
shnullcmd off
shoptionletters off
noshortloops off
shwordsplit off
singlecommand off
singlelinezle off
sourcetrace off
sunkeyboardhack off
transientrprompt off
trapsasync off
typesetsilent off
nounset off
verbose off
vi off
warncreateglobal off
xtrace off
zle on

51
doc/db/tested.txt Normal file
View file

@ -0,0 +1,51 @@
horosgrisa/autoenv
adolfoabegg/browse-commit
arzzen/calc.plugin.zsh
walesmd/caniuse.plugin.zsh
mollifier/cd-gitroot
MikeDacre/cdbk
willghatch/zsh-cdr
rutchkiwi/copyzshell (required OMZ directory structure simulation)
veelenga/crystal-zsh
jgrowl/depot_tools
gusaiani/elixir-oh-my-zsh
b4b4r07/emoji-cli
b4b4r07/enhancd
uvaes/fzf-marks
voronkovich/get-jquery.plugin.zsh
fontno/ghost_zeus
peterhurford/git-aliases.zsh
unixorn/git-extra-commands
peterhurford/git-it-on.zsh
tevren/gitfast-zsh-plugin
zsh-users/zsh-syntax-highlighting
voronkovich/gitignore.plugin.zsh
bbenne10/goenv
or17191/going_places
Seinh/git-prune
joepvd/grep2awk (failed, improper bindkey, the same with antigen)
robertzk/hipchat.zsh (unfull, HIPCHAT_API_TOKEN was required)
willghatch/zsh-hooks (problematic usage, the same with antigen)
mgryszko/jvm (problematic usage, the same with antigen)
rimraf/k
d12frosted/kitsunebook.plugin.zsh (a completion done via manual compdef call)
lesaint/lesaint-mvn
Temikus/mac-packaging
hlohm/mfunc (doesn't fully work, the same with antigen)
horosgrisa/mysql-colorize
voronkovich/mysql.plugin.zsh
bric3/nice-exit-code
chrissicool/zsh-bash
zsh-users/zaw
benclark/parallels-zsh-plugin
oz/safe-paste (works but has issues, the same on antigen)
willghatch/zsh-saneopt
willghatch/zsh-snippets (misses a bindkey, the same with antigen, otherwise works)
Tarrasch/zsh-colors
dbkaplun/smart-cd
skipped:
Stibbons/crayon-syntax-zsh (a wordpress plugin)
jsks/czhttpd (not a plugin, a software, a command)
Vifon/deer (not a plugin, provides manual installation instructions)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

44
doc/install.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/sh
#
# Clone or pull
#
if [ -z "$ZPLG_HOME" ]; then
ZPLG_HOME="${ZDOTDIR:-$HOME}/.zplugin"
fi
if ! test -d "$ZPLG_HOME"; then
mkdir "$ZPLG_HOME"
chmod g-rwX "$ZPLG_HOME"
fi
echo ">>> Downloading zplugin to $ZPLG_HOME/bin"
if test -d "$ZPLG_HOME/bin/.git"; then
cd "$ZPLG_HOME/bin"
git pull origin master
else
cd "$ZPLG_HOME"
git clone --depth 10 https://github.com/zdharma/zplugin.git bin
fi
echo ">>> Done"
#
# Modify .zshrc
#
THE_ZDOTDIR="${ZDOTDIR:-$HOME}"
if grep zplugin "$THE_ZDOTDIR/.zshrc" >/dev/null 2>&1; then
echo ">>> .zshrc already updated, not making changes"
exit 0
fi
echo ">>> Updating $THE_ZDOTDIR/.zshrc (3 lines of code, at the bottom)"
cat <<-EOF >> "$THE_ZDOTDIR/.zshrc"
### Added by Zplugin's installer
source '$ZPLG_HOME/bin/zplugin.zsh'
autoload -Uz _zplugin
(( \${+_comps} )) && _comps[zplugin]=_zplugin
### End of Zplugin's installer chunk
EOF
echo ">>> Done"

66
doc/mod-install.sh Executable file
View file

@ -0,0 +1,66 @@
#!/bin/sh
col_pname=""
col_error=""
col_info=""
col_info2=""
col_rst=""
echo "${col_info}Re-run this script to update (from Github) and rebuild the module.$col_rst"
#
# Clone or pull
#
ZPLG_HOME="${ZDOTDIR:-$HOME}/.zplugin"
if ! test -d "$ZPLG_HOME"; then
mkdir "$ZPLG_HOME"
chmod g-rwX "$ZPLG_HOME"
fi
echo ">>> Downloading zdharma/zplugin module to $ZPLG_HOME/mod-bin"
if test -d "$ZPLG_HOME/mod-bin/.git"; then
cd "$ZPLG_HOME/mod-bin"
git pull origin master
else
cd "$ZPLG_HOME"
git clone --depth 10 https://github.com/zdharma/zplugin.git mod-bin
fi
echo ">>> Done"
#
# Build the module
#
cd "$ZPLG_HOME/mod-bin/zmodules"
echo "$col_pname== Building module zdharma/zplugin, running: a make clean, then ./configure and then make ==$col_rst"
echo "$col_pname== The module sources are located at: $ZPLG_HOME/mod-bin/zmodules ==$col_rst"
test -f Makefile && { [ "$1" = "--clean" ] && {
echo "$col_info2-- make distclean --$col_rst"
make distclean
true
} || {
echo "$col_info2-- make clean (pass --clean to invoke \`make distclean') --$col_rst"
make clean
}
}
echo "$col_info2-- ./configure --$col_rst"
CPPFLAGS=-I/usr/local/include CFLAGS="-g -Wall -O3" LDFLAGS=-L/usr/local/lib ./configure --disable-gdbm && {
echo "$col_info2-- make --$col_rst"
make && {
echo "${col_info}Module has been built correctly.$col_rst"
echo "To load the module, add following 2 lines to .zshrc, at top:"
echo " module_path+=( \"$ZPLG_HOME/mod-bin/zmodules/Src\" )"
echo " zmodload zdharma/zplugin"
echo ""
echo "After loading, use command \`zpmod' to communicate with the module."
echo "See \`zpmod -h' for more information. There are two main features,"
echo "invocation of \`zpmod source-study' which shows \`source' profile"
echo "data, and guaranteed, automatic compilation of any sourced script"
echo "while the module is loaded (check with Zsh command \`zmodload')."
} || {
echo "${col_error}Module didn't build.$col_rst. You can copy the error messages and submit"
echo "error-report at: https://github.com/zdharma/zplugin/issues"
}
}

192
doc/test-excl-id-as Normal file
View file

@ -0,0 +1,192 @@
# fpath+=( `pwd`/doc )
# autoload test-id-as
# test-id-as
#
# Introduction of id-as (an ice-mod that allows to nickname
# any snippet or plugin) is a set of so many changes that
# more tests were needed, thus this file was created, real
# tests would took too long.
#
# Creates PLUGINS_DIR and SNIPPETS_DIR in /tmp. Can obtain
# --reuse option, to reuse existing PLUGINS_DIR & SNIPPETS_DIR.
autoload colors; colors
setopt localtraps typesetsilent
typeset -g plg_bkp="${ZPLGM[PLUGINS_DIR]}" snp_bkp="${ZPLGM[SNIPPETS_DIR]}" argv1="$1" argv2="$2"
[[ -z "$plg_bkp" || -z "$snp_bkp" ]] && { print "Zplugin not loaded? (the \$ZPLGM hash is missing fields)"; return 1; }
[[ "$plg_bkp" != /* || $snp_bkp != /* ]] && { print "PLUGINS_DIR and/or SNIPPETS_DIR isn't an absolute path, aborting"; return 1; }
if [[ "$argv1" != "--reuse" && "$argv2" != "--reuse" ]]; then
command rm -rf /tmp/zplg_plgs /tmp/zplg_snps
command mkdir -p /tmp/zplg_plgs /tmp/zplg_snps
ZPLGM[PLUGINS_DIR]=/tmp/zplg_plgs ZPLGM[SNIPPETS_DIR]=/tmp/zplg_snps
trap '[[ $argv1 != "--keep" && $argv2 != "--keep" ]] && { ZPLGM[PLUGINS_DIR]=$plg_bkp; ZPLGM[SNIPPETS_DIR]=$snp_bkp; } || { print; print "Kept ${ZPLGM[PLUGINS_DIR]} :: ${ZPLGM[SNIPPETS_DIR]}"; }; return 0;' EXIT INT TERM QUIT
fi
local INITIAL_CD="$PWD"
cd /tmp
print; print -- "$fg[green]..........Working dir: $PWD$reset_color.........."
print -- "Removing test-plugins & snippets from disk ..."
# This removal is in case of --reuse being passed to this script
command rm -rf -- ${ZPLGM[PLUGINS_DIR]}/mvdan---sh/ \
${ZPLGM[PLUGINS_DIR]}/oz---safe-paste \
${ZPLGM[PLUGINS_DIR]}/junegunn---fzf-bin \
${ZPLGM[PLUGINS_DIR]}/my---jun---gun \
${ZPLGM[PLUGINS_DIR]}/myid \
${ZPLGM[PLUGINS_DIR]}/myid---sub---1 \
${ZPLGM[PLUGINS_DIR]}/my---pure
command rm -rf -- ${ZPLGM[SNIPPETS_DIR]}/https--github.com--robbyrussell--oh-my-zsh--trunk--plugins \
${ZPLGM[SNIPPETS_DIR]}/MY-UNIQUE \
${ZPLGM[SNIPPETS_DIR]}/my \
${ZPLGM[SNIPPETS_DIR]}/myid/sub
print -- "Done."
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`github-$fg_bold[magenta]binary$fg_no_bold[red]'< $fg[magenta]mvdan$reset_color/$fg[yellow]sh$fg_bold[red] without$fg_no_bold[red] id-as nickname$reset_color"
print zplugin ice from"gh-r" as"command" mv\""shfmt* -> shfmt"\"\; zplugin load mvdan/sh
zplugin ice from"gh-r" as"command" mv"shfmt* -> shfmt"; zplugin load mvdan/sh
zplugin cd mvdan/sh; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete mvdan/sh
zplugin cd mvdan/sh && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`single-file plugin' $fg[magenta]oz$reset_color/$fg[yellow]safe-paste$fg_bold[red] without$fg_no_bold[red] id-as nickname$reset_color"
print zplugin load oz/safe-paste
zplugin load oz/safe-paste
zplugin cd oz/safe-paste; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete oz/safe-paste
zplugin cd oz/safe-paste && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`github-$fg_bold[magenta]binary$fg_no_bold[red]'< $fg[magenta]junegunn$reset_color/$fg[yellow]fzf-bin$fg_bold[red] without$fg_no_bold[red] id-as nickname$reset_color"
print zplugin ice from"gh-r" as"command" mv"fzf* -> fzf1" atpull\'"!rm -f fzf2; touch fzf.txt"\'\; zplugin light junegunn/fzf-bin
zplugin ice from"gh-r" as"command" mv"fzf* -> fzf1" atpull'!rm -f fzf2; touch fzf.txt'; zplugin light junegunn/fzf-bin
zplugin cd junegunn/fzf-bin; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete junegunn/fzf-bin
zplugin cd junegunn/fzf-bin && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`github-$fg_bold[magenta]binary$fg_no_bold[red]'< $fg[magenta]junegunn$reset_color/$fg[yellow]fzf-bin$fg_bold[green] AS ::\`$fg[red]!my/jun/gun$fg_bold[green]'::$reset_color"
print zplugin ice from"gh-r" as"command" mv"fzf* -> fzf2" id-as\"\\\\\!my/jun/gun\"\; zplugin load junegunn/fzf-bin
zplugin ice from"gh-r" as"command" mv"fzf* -> fzf2" id-as"!my/jun/gun"; zplugin load junegunn/fzf-bin
zplugin cd my/jun/gun; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete my/jun/gun
zplugin cd my/jun/gun && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`theme'< $fg[magenta]agkozak$reset_color/$fg[yellow]agkozak-zsh-theme$fg_bold[green] AS ::\`$fg[red]!myid$fg_bold[green]'::$reset_color"
print zplugin ice id-as\"\\\\\!myid\"\; zplugin load agkozak/agkozak-zsh-theme
zplugin ice id-as"!myid"; zplugin load agkozak/agkozak-zsh-theme
zplugin cd myid; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete myid
zplugin cd myid && ls -lthd .*(N) *(N)
sleep 3
print; print -- "$fg[green]Unloading $fg[red]::\`myid'::$fg[green] (agkozak/agkozak-zsh-theme)$reset_color"
zplugin unload myid > /tmp/myid.unload.txt
head -n 4 /tmp/myid.unload.txt
head -n 17 /tmp/myid.unload.txt | tail -n 4
sleep 5
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`theme'< $fg[magenta]agkozak$reset_color/$fg[yellow]agkozak-zsh-theme$fg_bold[green] AS ::\`$fg[red]!myid/sub/1$fg_bold[green]'::$reset_color"
print zplugin ice id-as\"\\\\\!myid/sub/1\"\; zplugin load agkozak/agkozak-zsh-theme
zplugin ice id-as"!myid/sub/1"; zplugin load agkozak/agkozak-zsh-theme
zplugin cd myid/sub/1; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete myid/sub/1
zplugin cd myid/sub/1 && ls -lthd .*(N) *(N)
sleep 3
print; print -- "$green[green]Report of $fg[red]::\`myid/sub/1'::$fg[green] (agkozak/agkozak-zsh-theme)$reset_color"
zplugin report myid/sub/1 > /tmp/myid--sub--1.report.txt
head -n 10 /tmp/myid--sub--1.report.txt | tail -n 8
sleep 5
print; print -- "$fg[green]Unloading $fg[red]::\`myid/sub/1'::$fg[green] (agkozak/agkozak-zsh-theme)$reset_color"
zplugin unload myid/sub/1 > /tmp/myid--sub--1.unload.txt
head -n 4 /tmp/myid--sub--1.unload.txt
head -n 17 /tmp/myid--sub--1.unload.txt | tail -n 4
sleep 5
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`theme'< $fg[magenta]sindresorhus$reset_color/$fg[yellow]pure$fg_bold[green] AS ::\`$fg[red]!my/pure$fg_bold[green]'::$reset_color"
print zplugin ice multisrc\"\{async,pure\}.zsh\" pick"/dev/null" id-as\"\\\\\!my/pure\"\; zplugin load sindresorhus/pure
zplugin ice multisrc"{async,pure}.zsh" pick"/dev/null" id-as"!my/pure"; zplugin load sindresorhus/pure
zplugin cd my/pure; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete my/pure
zplugin cd my/pure && ls -lthd .*(N) *(N)
sleep 3
print
print -- "\n\n\n"$fg_bold[red]SNIPPETS START NOW$reset_color
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`OMZ plugin (svn)'< $fg[magenta]OMZ::plugins$reset_color/$fg[yellow]pip$fg_bold[red] without$fg_no_bold[red] id-as nickname$reset_color"
zplugin ice svn; zplugin snippet OMZ::plugins/pip
zplugin cd OMZ::plugins/pip; ls -lthd .*(N) *(N)
sleep 3
zplugin creinstall %SNIPPETS/OMZ::plugins/pip
sleep 3
cd $OLDPWD
zplugin delete OMZ::plugins/pip
zplugin cd OMZ::plugins/pip && ls -lthd .*(N) *(N)
zplugin cclear
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`single-file command-snippet' $fg[magenta]GH::Osse/git-scripts/blob/master/git-unique$fg_bold[green] AS ::\`$fg[red]!MY-UNIQUE$fg_bold[green]'::$reset_color"
zplugin ice as"program" id-as\"\\\\\!MY-UNIQUE\"; zplugin snippet https://github.com/Osse/git-scripts/blob/master/git-unique
zplugin ice as"program" id-as"!MY-UNIQUE"; zplugin snippet https://github.com/Osse/git-scripts/blob/master/git-unique
zplugin cd MY-UNIQUE; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete MY-UNIQUE
zplugin cd MY-UNIQUE && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`OMZ plugin (svn)'< $fg[magenta]OMZ::plugins$reset_color/$fg[yellow]git$fg_bold[green] AS ::\`$fg[red]!my$fg_bold[green]'::$reset_color"
print zplugin ice svn id-as\"\\\\\!my\"\; zplugin snippet OMZ::plugins/git
zplugin ice svn id-as"!my"; zplugin snippet OMZ::plugins/git
zplugin cd my; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete my
zplugin cd my && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`OMZ plugin (svn)'< $fg[magenta]OMZ::plugins$reset_color/$fg[yellow]gradle$fg_bold[green] AS ::\`$fg[red]!myid/sub$fg_bold[green]'::$reset_color"
print zplugin ice svn id-as\"\\\\\!myid/sub\"\; zplugin snippet OMZ::plugins/gradle
zplugin ice svn id-as"!myid/sub"; zplugin snippet OMZ::plugins/gradle
zplugin cd myid/sub; ls -lthd .*(N) *(N)
sleep 3
zplugin creinstall %SNIPPETS/myid/sub
sleep 3
cd $OLDPWD
zplugin delete myid/sub
zplugin cd myid/sub && ls -lthd .*(N) *(N)
zplugin cclear
cd $INITIAL_CD
# vim:ft=zsh:sts=4:sw=4:et

182
doc/test-id-as Normal file
View file

@ -0,0 +1,182 @@
# fpath+=( `pwd`/doc )
# autoload test-id-as
# test-id-as
#
# Introduction of id-as (an ice-mod that allows to nickname
# any snippet or plugin) is a set of so many changes that
# more tests were needed, thus this file was created, real
# tests would took too long.
#
# Creates PLUGINS_DIR and SNIPPETS_DIR in /tmp. Can obtain
# --reuse option, to reuse existing PLUGINS_DIR & SNIPPETS_DIR.
autoload colors; colors
setopt localtraps typesetsilent
typeset -g plg_bkp="${ZPLGM[PLUGINS_DIR]}" snp_bkp="${ZPLGM[SNIPPETS_DIR]}" argv1="$1" argv2="$2"
[[ -z "$plg_bkp" || -z "$snp_bkp" ]] && { print "Zplugin not loaded? (the \$ZPLGM hash is missing fields)"; return 1; }
[[ "$plg_bkp" != /* || $snp_bkp != /* ]] && { print "PLUGINS_DIR and/or SNIPPETS_DIR isn't an absolute path, aborting"; return 1; }
if [[ "$argv1" != "--reuse" && "$argv2" != "--reuse" ]]; then
command rm -rf /tmp/zplg_plgs /tmp/zplg_snps
command mkdir -p /tmp/zplg_plgs /tmp/zplg_snps
ZPLGM[PLUGINS_DIR]=/tmp/zplg_plgs ZPLGM[SNIPPETS_DIR]=/tmp/zplg_snps
trap '[[ $argv1 != "--keep" && $argv2 != "--keep" ]] && { ZPLGM[PLUGINS_DIR]=$plg_bkp; ZPLGM[SNIPPETS_DIR]=$snp_bkp; } || { print; print "Kept ${ZPLGM[PLUGINS_DIR]} :: ${ZPLGM[SNIPPETS_DIR]}"; }; return 0;' EXIT INT TERM QUIT
fi
local INITIAL_CD="$PWD"
cd /tmp
print; print -- "$fg[green]..........Working dir: $PWD$reset_color.........."
print -- "Removing test-plugins & snippets from disk ..."
# This removal is in case of --reuse being passed to this script
command rm -rf -- ${ZPLGM[PLUGINS_DIR]}/mvdan---sh/ \
${ZPLGM[PLUGINS_DIR]}/oz---safe-paste \
${ZPLGM[PLUGINS_DIR]}/junegunn---fzf-bin \
${ZPLGM[PLUGINS_DIR]}/my---jun---gun \
${ZPLGM[PLUGINS_DIR]}/myid \
${ZPLGM[PLUGINS_DIR]}/myid---sub---1 \
${ZPLGM[PLUGINS_DIR]}/my---pure
command rm -rf -- ${ZPLGM[SNIPPETS_DIR]}/https--github.com--robbyrussell--oh-my-zsh--trunk--plugins \
${ZPLGM[SNIPPETS_DIR]}/MY-UNIQUE \
${ZPLGM[SNIPPETS_DIR]}/my \
${ZPLGM[SNIPPETS_DIR]}/myid/sub
print -- "Done."
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`github-$fg_bold[magenta]binary$fg_no_bold[red]'< $fg[magenta]mvdan$reset_color/$fg[yellow]sh$fg_bold[red] without$fg_no_bold[red] id-as nickname$reset_color"
zplugin ice from"gh-r" as"command" mv"shfmt* -> shfmt"; zplugin load mvdan/sh
zplugin cd mvdan/sh; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete mvdan/sh
zplugin cd mvdan/sh && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`single-file plugin' $fg[magenta]oz$reset_color/$fg[yellow]safe-paste$fg_bold[red] without$fg_no_bold[red] id-as nickname$reset_color"
zplugin load oz/safe-paste
zplugin cd oz/safe-paste; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete oz/safe-paste
zplugin cd oz/safe-paste && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`github-$fg_bold[magenta]binary$fg_no_bold[red]'< $fg[magenta]junegunn$reset_color/$fg[yellow]fzf-bin$fg_bold[red] without$fg_no_bold[red] id-as nickname$reset_color"
zplugin ice from"gh-r" as"command" mv"fzf* -> fzf1" atpull'!rm -f fzf2; touch fzf.txt'; zplugin light junegunn/fzf-bin
zplugin cd junegunn/fzf-bin; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete junegunn/fzf-bin
zplugin cd junegunn/fzf-bin && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`github-$fg_bold[magenta]binary$fg_no_bold[red]'< $fg[magenta]junegunn$reset_color/$fg[yellow]fzf-bin$fg_bold[green] AS ::\`$fg[red]my/jun/gun$fg_bold[green]'::$reset_color"
zplugin ice from"gh-r" as"command" mv"fzf* -> fzf2" id-as"my/jun/gun"; zplugin load junegunn/fzf-bin
zplugin cd my/jun/gun; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete my/jun/gun
zplugin cd my/jun/gun && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`theme'< $fg[magenta]agkozak$reset_color/$fg[yellow]agkozak-zsh-theme$fg_bold[green] AS ::\`$fg[red]myid$fg_bold[green]'::$reset_color"
zplugin ice id-as"myid"; zplugin load agkozak/agkozak-zsh-theme
zplugin cd myid; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete myid
zplugin cd myid && ls -lthd .*(N) *(N)
sleep 3
print; print -- "$fg[green]Unloading $fg[red]::\`myid'::$fg[green] (agkozak/agkozak-zsh-theme)$reset_color"
zplugin unload myid > /tmp/myid.unload.txt
head -n 4 /tmp/myid.unload.txt
head -n 17 /tmp/myid.unload.txt | tail -n 4
sleep 5
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`theme'< $fg[magenta]agkozak$reset_color/$fg[yellow]agkozak-zsh-theme$fg_bold[green] AS ::\`$fg[red]myid/sub/1$fg_bold[green]'::$reset_color"
zplugin ice id-as"myid/sub/1"; zplugin load agkozak/agkozak-zsh-theme
zplugin cd myid/sub/1; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete myid/sub/1
zplugin cd myid/sub/1 && ls -lthd .*(N) *(N)
sleep 3
print; print -- "$green[green]Report of $fg[red]::\`myid/sub/1'::$fg[green] (agkozak/agkozak-zsh-theme)$reset_color"
zplugin report myid/sub/1 > /tmp/myid--sub--1.report.txt
head -n 10 /tmp/myid--sub--1.report.txt | tail -n 8
sleep 5
print; print -- "$fg[green]Unloading $fg[red]::\`myid/sub/1'::$fg[green] (agkozak/agkozak-zsh-theme)$reset_color"
zplugin unload myid/sub/1 > /tmp/myid--sub--1.unload.txt
head -n 4 /tmp/myid--sub--1.unload.txt
head -n 17 /tmp/myid--sub--1.unload.txt | tail -n 4
sleep 5
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`theme'< $fg[magenta]sindresorhus$reset_color/$fg[yellow]pure$fg_bold[green] AS ::\`$fg[red]my/pure$fg_bold[green]'::$reset_color"
zplugin ice multisrc"{async,pure}.zsh" pick"/dev/null" id-as"my/pure"; zplugin load sindresorhus/pure
zplugin cd my/pure; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete my/pure
zplugin cd my/pure && ls -lthd .*(N) *(N)
sleep 3
print
print -- "\n\n\n"$fg_bold[red]SNIPPETS START NOW$reset_color
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`OMZ plugin (svn)'< $fg[magenta]OMZ::plugins$reset_color/$fg[yellow]pip$fg_bold[red] without$fg_no_bold[red] id-as nickname$reset_color"
zplugin ice svn; zplugin snippet OMZ::plugins/pip
zplugin cd OMZ::plugins/pip; ls -lthd .*(N) *(N)
sleep 3
zplugin creinstall %SNIPPETS/OMZ::plugins/pip
sleep 3
cd $OLDPWD
zplugin delete OMZ::plugins/pip
zplugin cd OMZ::plugins/pip && ls -lthd .*(N) *(N)
zplugin cclear
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`single-file command-snippet' $fg[magenta]GH::Osse/git-scripts/blob/master/git-unique$fg_bold[green] AS ::\`$fg[red]MY-UNIQUE$fg_bold[green]'::$reset_color"
zplugin ice as"program" id-as"MY-UNIQUE"; zplugin snippet https://github.com/Osse/git-scripts/blob/master/git-unique
zplugin cd MY-UNIQUE; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete MY-UNIQUE
zplugin cd MY-UNIQUE && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`OMZ plugin (svn)'< $fg[magenta]OMZ::plugins$reset_color/$fg[yellow]git$fg_bold[green] AS ::\`$fg[red]my$fg_bold[green]'::$reset_color"
zplugin ice svn id-as"my"; zplugin snippet OMZ::plugins/git
zplugin cd my; ls -lthd .*(N) *(N)
cd $OLDPWD
zplugin delete my
zplugin cd my && ls -lthd .*(N) *(N)
sleep 3
print; print -- "\n\n\n$fg[green]----------\nInstalling $fg[red]>\`OMZ plugin (svn)'< $fg[magenta]OMZ::plugins$reset_color/$fg[yellow]gradle$fg_bold[green] AS ::\`$fg[red]myid/sub$fg_bold[green]'::$reset_color"
zplugin ice svn id-as"myid/sub"; zplugin snippet OMZ::plugins/gradle
zplugin cd myid/sub; ls -lthd .*(N) *(N)
sleep 3
zplugin creinstall %SNIPPETS/myid/sub
sleep 3
cd $OLDPWD
zplugin delete myid/sub
zplugin cd myid/sub && ls -lthd .*(N) *(N)
zplugin cclear
cd $INITIAL_CD
# vim:ft=zsh:sts=4:sw=4:et

3
doc/zcompile Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env zsh
zcompile "$@"

File diff suppressed because it is too large Load diff

593
doc/zplugin.1 Normal file
View file

@ -0,0 +1,593 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "README" "" "May 2017" "" ""
Zplugin gives \fBreports\fR from plugin load\. Plugins are no longer black boxes, report will tell what aliases, functions, bindkeys, Zle widgets, zstyles, completions, variables, \fBPATH\fR and \fBFPATH\fR elements a plugin has set up\. Supported is \fBunloading\fR of plugin and ability to list, uninstall, reinstall and selectively disable, enable plugin\'s completions\. Also, every plugin is compiled and user can control this function\. The system does not use \fB$FPATH\fR, it\'s kept clean!
.
.P
Code is immune to \fBKSH_ARRAYS\fR, \fBemulate sh\fR, \fBemulate ksh\fR, thoroughly tested to support any user setup, be as transparent as plain \fBsource\fR command\. Completion management functionality is provided to allow user call \fBcompinit\fR only once in \fB\.zshrc\fR\.To install, execute:
.
.IP "" 4
.
.nf
sh \-c "$(curl \-fsSL https://raw\.githubusercontent\.com/psprint/zplugin/master/doc/install\.sh)"
.
.fi
.
.IP "" 0
.
.P
Then add to \fB~/\.zshrc\fR, at bottom:
.
.IP "" 4
.
.nf
zplugin load psprint zsh\-navigation\-tools
zplugin ice from"notabug" atload"echo loaded zui" if"(( 1 ))"
zplugin load zdharma/zui
zplugin load zsh\-users/zsh\-autosuggestions
zplugin light zsh\-users/zsh\-syntax\-highlighting
.
.fi
.
.IP "" 0
.
.P
(No need to add:
.
.IP "" 4
.
.nf
source "$HOME/\.zplugin/bin/zplugin\.zsh"
.
.fi
.
.IP "" 0
.
.P
because the install script does this\.)
.
.P
\fBZNT\fR multi\-word searching of history (Ctrl\-R), \fBzui\fR  textual UI library for Zshell\. The \fBice\fR subcommand  modifiers for following single command\. \fBnotabug\fR  the site \fBnotabug\.org\fR
.
.IP "\(bu" 4
.SH "News"
.
.IP "" 0
.
23\-05\-2017
.
.IP "\(bu" 4
New \fBice\fR modifier: \fBif\fR, to which you can provide a conditional expression
.
.IP "" 4
.
.nf
% zplg ice if"(( 0 ))"
% zplg snippet \-\-command https://github\.com/b4b4r07/httpstat/blob/master/httpstat\.sh
% zplg ice if"(( 1 ))"
% zplg snippet \-\-command https://github\.com/b4b4r07/httpstat/blob/master/httpstat\.sh
Setting up snippet httpstat\.sh
Downloading httpstat\.sh\.\.\.
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.IP "\(bu" 4
16\-05\-2017
.
.IP "\(bu" 4
A very slick feature: \fBadding ice to commands\fR\. Ice is something added and something that melts\. You add modifiers to single next command, and the format (using quotes) guarantees you will see the syntax highlighted in editors:
.
.IP "" 4
.
.nf
% zplg ice from"notabug" atload"echo \-\-Loaded\-\-" atclone"echo \-\-Cloned\-\-"
% zplg load zdharma/zui
Downloading zdharma/zui\.\.\.
\.\.\.
Checking connectivity\.\.\. done\.
\-\-Cloned\-\-
Compiling zui\.plugin\.zsh\.\.\.
\-\-Loaded\-\-
% grep notabug ~/\.zplugin/plugins/zdharma\-\-\-zui/\.git/config
url = https://notabug\.org/zdharma/zui
.
.fi
.
.IP "" 0
.
.IP
One other \fBice\fR is \fBproto\fR\. Use \fBproto"git"\fR with Github to be able to use private repositories\.
.
.IP "\(bu" 4
Completion\-management supports completions provided in subdirectory, like in \fBzsh\-users/zsh\-completions\fR plugin\. With \fBice\fR modifier \fBblockf\fR (block\-fpath), you can manage such completions:
.
.IP "" 4
.
.nf
% zplg ice blockf
% zplg load zsh\-users/zsh\-completions
\.\.\.
Symlinking completion `_ack\' to /Users/sgniazdowski/\.zplugin/completions
Forgetting completion `_ack\'\.\.\.
Symlinking completion `_afew\' to /Users/sgniazdowski/\.zplugin/completions
Forgetting completion `_afew\'\.\.\.
\.\.\.
Compiling zsh\-completions\.plugin\.zsh\.\.\.
% echo $fpath
/Users/sgniazdowski/\.zplugin/completions /usr/local/share/zsh/site\-functions
% zplg cdisable vagrant
Disabled vagrant completion belonging to zsh\-users/zsh\-completions
Forgetting completion `_vagrant\'\.\.\.
Initializing completion system (compinit)\.\.\.
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.IP "\(bu" 4
14\-05\-2017
.
.IP "\(bu" 4
The \fBall\fR\-variants of commands (e\.g\. \fBupdate\-all\fR) have been merged into normal variants (with \fB\-\-all\fR switch)
.
.IP "" 0
.
.IP "\(bu" 4
13\-05\-2017
.
.IP "\(bu" 4
Bug fixes related to local plugins
.
.IP "\(bu" 4
\fB100\fR \fBms\fR gain in performance
.
.IP "\(bu" 4
When updating plugin a list of new commits is shown
.
.IP "\(bu" 4
\fBlftp\fR as fallback transport support for snippets
.
.IP "\(bu" 4
Snippets support \fBftp\fR and \fBscp\fR protocols
.
.IP "\(bu" 4
With snippets you can load a file as \fBcommand\fR that is added to PATH:
.
.IP "" 4
.
.nf
% zplg snippet \-\-command https://github\.com/b4b4r07/httpstat/blob/master/httpstat\.sh
% httpstat\.sh
too few arguments
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
Snippets are updated on \fBupdate \-\-all\fR command
.
.IP "" 0
.
.SH "Introduction"
.
.P
\fBExample use:\fR
.
.IP "" 4
.
.nf
% \. ~/github/zplugin/zplugin\.zsh
% zplugin light zsh\-users/zsh\-syntax\-highlighting
% zplugin load psprint/zsh\-cmd\-architect
.
.fi
.
.IP "" 0
.
.P
\fBExample plugin report:\fR
.
.IP "" 4
.
.nf
% zpl report psprint/zsh\-cmd\-architect
Plugin report for psprint/zsh\-cmd\-architect
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
Source zsh\-cmd\-architect\.plugin\.zsh
Autoload h\-list
Autoload h\-list\-input
Autoload h\-list\-draw
Autoload zca
Autoload zca\-usetty\-wrapper
Autoload zca\-widget
Zle \-N zca\-widget
Bindkey ^T zca\-widget
Functions created:
h\-list h\-list\-draw
h\-list\-input zca
zca\-usetty\-wrapper zca\-widget
Options changed:
autolist was unset
menucomplete was unset
PATH elements added:
/Users/sgniazdowski/github/zsh\-cmd\-architect/bin
FPATH elements added:
/Users/sgniazdowski/github/zsh\-cmd\-architect
Completions:
_xauth [disabled]
.
.fi
.
.IP "" 0
.
.P
.
.P
\fBExample plugin unload:\fR
.
.IP "" 4
.
.nf
% zpl unload psprint/zsh\-cmd\-architect
Deleting function h\-list
Deleting function h\-list\-draw
Deleting function h\-list\-input
Deleting function zca
Deleting function zca\-usetty\-wrapper
Deleting function zca\-widget
Deleting bindkey ^T zca\-widget
Setting option autolist
Setting option menucomplete
Removing PATH element /Users/sgniazdowski/github/zsh\-cmd\-architect/bin
Removing FPATH element /Users/sgniazdowski/github/zsh\-cmd\-architect
Unregistering plugin psprint/zsh\-cmd\-architect
Plugin\'s report saved to $LASTREPORT
.
.fi
.
.IP "" 0
.
.P
.
.P
\fBExample \fBcsearch\fR invocation (completion management):\fR
.
.IP "" 4
.
.nf
# zplg csearch
[+] is installed, [\-] uninstalled, [+\-] partially installed
[+] _local/zplugin _zplugin
[\-] benclark/parallels\-zsh\-plugin _parallels
[+] mollifier/cd\-gitroot _cd\-gitroot
[\-] or17191/going_places _favrm, _go
[\-] psprint/zsh\-cmd\-architect _xauth
[\-] psprint/zsh\-editing\-workbench _cp
[+] tevren/gitfast\-zsh\-plugin _git
.
.fi
.
.IP "" 0
.
.P
.
.P
\fBExample \fBcompile\fR invocation:\fR
.
.IP "" 4
.
.nf
# zplg compile zsh\-users/zsh\-syntax\-highlighting
Compiling zsh\-syntax\-highlighting\.plugin\.zsh\.\.\.
# zplg compiled
zsh\-users/zsh\-syntax\-highlighting:
zsh\-syntax\-highlighting\.plugin\.zsh\.zwc
# zplg uncompile zsh\-users/zsh\-syntax\-highlighting
Removing zsh\-syntax\-highlighting\.plugin\.zsh\.zwc
# zplg compiled
No compiled plugins
# zplg compile\-all
zsh\-users/zsh\-syntax\-highlighting
Compiling zsh\-syntax\-highlighting\.plugin\.zsh\.\.\.
.
.fi
.
.IP "" 0
.
.P
.
.P
\fBExample \fBcreate\fR invocation:\fR
.
.IP "" 4
.
.nf
% zplg create psprint/testplugin
Github user name or just "_local": psprint
Plugin name: testplugin2
Plugin is psprint/testplugin2
Creating Github repository
Enter host password for user \'psprint\':
Cloning into \'psprint\-\-\-testplugin2\'\.\.\.
warning: You appear to have cloned an empty repository\.
Checking connectivity\.\.\. done\.
Remote repository psprint/testplugin2 set up as origin
You\'re in plugin\'s local folder
The files aren\'t added to git
Your next step after commiting will be:
git push \-u origin master
% ls
\.git README\.md
LICENSE testplugin2\.plugin\.zsh
.
.fi
.
.IP "" 0
.
.P
.
.SH "Installation"
Execute:
.
.IP "" 4
.
.nf
sh \-c "$(curl \-fsSL https://raw\.githubusercontent\.com/psprint/zplugin/master/doc/install\.sh)"
.
.fi
.
.IP "" 0
.
.P
To update run the command again (or just execute \fBdoc/install\.sh\fR) or run \fBzplugin self\-update\fR\.
.
.P
\fBZplugin\fR will be installed into \fB~/\.zplugin/bin\fR\. \fB\.zshrc\fR will be updated with three lines of code that will be added to the bottom (the lines will be sourcing \fBzplugin\.zsh\fR and setting up completion)\.
.
.P
Completion will be available, for command \fBzplugin\fR and aliases \fBzpl\fR, \fBzplg\fR\.
.
.P
After installing and reloading shell give \fBZplugin\fR a quick try with \fBzplugin help\fR\.
.
.SH "Manual installation"
To manually install \fBZplugin\fR clone the repo to e\.g\. \fB~/\.zplugin/bin\fR:
.
.IP "" 4
.
.nf
mkdir ~/\.zplugin
git clone https://github\.com/psprint/zplugin\.git ~/\.zplugin/bin
.
.fi
.
.IP "" 0
.
.P
and source it from \fB\.zshrc\fR (\fBabove compinit\fR):
.
.IP "" 4
.
.nf
source ~/\.zplugin/bin/zplugin\.zsh
.
.fi
.
.IP "" 0
.
.P
If you place the \fBsource\fR below \fBcompinit\fR, then add those two lines after the \fBsource\fR: \fBsh autoload \-Uz _zplugin (( ${+_comps} )) && _comps[zplugin]=_zplugin\fR
.
.P
After installing and reloading shell give \fBZplugin\fR a quick try with \fBzplugin help\fR\.
.
.SS "Compilation"
It\'s good to compile \fBzplugin\fR into \fBZsh\fR bytecode:
.
.IP "" 4
.
.nf
zcompile ~/\.zplugin/bin/zplugin\.zsh
.
.fi
.
.IP "" 0
.
.P
Zplugin will compile each newly downloaded plugin\. You can clear compilation of a plugin by invoking \fBzplugin uncompile {plugin\-spec}\fR\. There are also commands \fBcompile\fR, \fBcompiled\fR that control the functionality of compiling plugins\.
.
.SH "Usage"
.
.nf
% zpl help
Usage:
\-h|\-\-help|help \- usage information
man \- manual
self\-update \- updates Zplugin
load {plugin\-name} \- load plugin
light {plugin\-name} \- light plugin load, without reporting
unload {plugin\-name} \- unload plugin
snippet [\-f] [\-\-command] {url} \- source (or add to PATH with \-\-command) local or remote file (\-f: force \- don\'t use cache)
update {plugin\-name} \- Git update plugin (or all plugins and snippets if \-\-all passed)
status {plugin\-name} \- Git status for plugin (or all plugins if \-\-all passed)
report {plugin\-name} \- show plugin\'s report (or all plugins\' if \-\-all passed)
loaded|list [keyword] \- show what plugins are loaded (filter with `keyword\')
cd {plugin\-name} \- cd into plugin\'s directory
create {plugin\-name} \- create plugin (also together with Github repository)
edit {plugin\-name} \- edit plugin\'s file with $EDITOR
glance {plugin\-name} \- look at plugin\'s source (pygmentize, {,source\-}highlight)
stress {plugin\-name} \- test plugin for compatibility with set of options
changes {plugin\-name} \- view plugin\'s git log
recently [time\-spec] \- show plugins that changed recently, argument is e\.g\. 1 month 2 days
clist|completions \- list completions in use
cdisable {cname} \- disable completion `cname\'
cenable {cname} \- enable completion `cname\'
creinstall {plugin\-name} \- install completions for plugin
cuninstall {plugin\-name} \- uninstall completions for plugin
csearch \- search for available completions from any plugin
compinit \- refresh installed completions
dtrace|dstart \- start tracking what\'s going on in session
dstop \- stop tracking what\'s going on in session
dunload \- revert changes recorded between dstart and dstop
dreport \- report what was going on in session
dclear \- clear report of what was going on in session
compile {plugin\-name} \- compile plugin (or all plugins if \-\-all passed)
uncompile {plugin\-name} \- remove compiled version of plugin (or of all plugins if \-\-all passed)
compiled \- list plugins that are compiled
.
.fi
.
.P
To use themes created for \fBOh\-My\-Zsh\fR you might want to first source the \fBgit\fR library there:
.
.IP "" 4
.
.nf
zplugin snippet \'http://github\.com/robbyrussell/oh\-my\-zsh/raw/master/lib/git\.zsh\'
.
.fi
.
.IP "" 0
.
.P
Then you can use the themes as snippets (\fBzplugin snippet {file path or Github URL}\fR)\. Some themes require not only \fBOh\-My\-Zsh\'s\fR \fBgit\fR library, but also \fBgit\fR plugin (error about function \fBcurrent_branch\fR appears)\. Source it as snippet directly from \fBOh\-My\-Zsh\fR:
.
.IP "" 4
.
.nf
zplugin snippet \'https://github\.com/robbyrussell/oh\-my\-zsh/raw/master/plugins/git/git\.plugin\.zsh\'
.
.fi
.
.IP "" 0
.
.P
Such lines should be added to \fB\.zshrc\fR\. Snippets are cached locally, use \fB\-f\fR option to download a fresh version of a snippet\.
.
.P
Most themes require \fBpromptsubst\fR option (\fBsetopt promptsubst\fR in \fBzshrc\fR), if it isn\'t set prompt will appear as something like: \fB$(build_prompt)\fR\.
.
.P
You might want to supress completions provided by the git plugin by issuing \fBzplugin cdclear \-q\fR (\fB\-q\fR is for quiet)  see below \fBIgnoring Compdefs\fR\.
.
.P
To summarize:
.
.IP "" 4
.
.nf
zplugin snippet \'http://github\.com/robbyrussell/oh\-my\-zsh/raw/master/lib/git\.zsh\'
zplugin snippet \'https://github\.com/robbyrussell/oh\-my\-zsh/raw/master/plugins/git/git\.plugin\.zsh\'
zplugin cdclear \-q # <\- forget completions provided up to this moment
setopt promptsubst
# Load theme
zplugin snippet \'https://github\.com/robbyrussell/oh\-my\-zsh/blob/master/themes/dstufft\.zsh\-theme\'
# Load plugin\-theme depending on OMZ git library
zplugin light NicoSantangelo/Alpharized
.
.fi
.
.IP "" 0
.
.SH "Calling compinit"
Compinit should be called after loading of all plugins and before possibly calling \fBcdreply\fR\. \fBZplugin\fR takes control over completions, symlinks them to \fB~/\.zplugin/completions\fR and adds this directory to \fB$FPATH\fR\. You manage those completions via commands starting with \fBc\fR: \fBcsearch\fR, \fBclist\fR, \fBcreinstall\fR, \fBcuninstall\fR, \fBcenable\fR, \fBcdisable\fR\. All this brings order to \fB$FPATH\fR, there is only one directory there\. Also, plugins aren\'t allowed to simply run \fBcompdefs\fR\. You can decide whether to run \fBcompdefs\fR by issuing \fBzplugin cdreplay\fR (\fBcompdef\fR\-replay)\. To summarize:
.
.IP "" 4
.
.nf
source ~/\.zplugin/bin/zplugin\.zsh
zplugin load "some/plugin"
\.\.\.
zplugin load "other/plugin"
autoload \-Uz compinit
compinit
zplugin cdreplay \-q # \-q is for quiet
.
.fi
.
.IP "" 0
.
.P
This allows to call compinit once\. Performance gains are huge, example shell startup time with double \fBcompinit\fR: \fB0\.980\fR sec, with \fBcdreplay\fR and single \fBcompinit\fR: \fB0\.156\fR sec\.
.
.SH "Ignoring Compdefs"
If you want to ignore \fBcompdef\fRs provided by some plugins or snippets, place their load commands before commands loading other plugins or snippets, and issue \fBzplugin cdclear\fR:
.
.IP "" 4
.
.nf
source ~/\.zplugin/bin/zplugin\.zsh
zplugin snippet https://github\.com/robbyrussell/oh\-my\-zsh/blob/master/plugins/git/git\.plugin\.zsh
zplugin cdclear \-q # <\- forget completions provided up to this moment
zplugin load "some/plugin"
\.\.\.
zplugin load "other/plugin"
autoload \-Uz compinit
compinit
zplugin cdreplay \-q # <\- execute compdefs provided by rest of plugins
zplugin cdlist # look at gathered compdefs
.
.fi
.
.IP "" 0
.
.SH "Non\-Github (local) plugins"
Use \fBcreate\fR command with user name \fB_local\fR (the default) to create plugin\'s skeleton\. It will be not connected with Github repository (because of user name being \fB_local\fR)\. To enter the plugin\'s directory use \fBcd\fR command with just plugin\'s name (without \fB_local\fR)\.
.
.P
The special user name \fB_local\fR is optional also for other commands, e\.g\. for \fBload\fR (i\.e\. \fBzplugin load myplugin\fR is sufficient, there\'s no need for \fBzplugin load _local/myplugin\fR)\.
.
.SH "IRC channel"
Simply connect to chat\.freenode\.net:6697 \fIircs://chat\.freenode\.net:6697/%23zplugin\fR (SSL) or chat\.freenode\.net:6667 \fIirc://chat\.freenode\.net:6667/%23zplugin\fR and join #zplugin\.
.
.P
Following is a quick access via Webchat \fIhttps://kiwiirc\.com/client/chat\.freenode\.net:+6697/#zplugin\fR

View file

@ -1,57 +0,0 @@
# This Makefile is to convert supplied Asciidoc files into
# other formats like pdf and man. The files contain Zplugin's
# code documentation.
#
# *.adoc files are generated by Makefile from upper (i.e. top)
# directory.
all: man pdf
# MANUALS
# Converted with a2x from asciidoc package
man: man/zinit.zsh.1 man/zinit-side.zsh.1 man/zinit-install.zsh.1 man/zinit-autoload.zsh.1
man/zinit.zsh.1:
@mkdir -p man
a2x --verbose -L --doctype manpage --format manpage -D man zinit.zsh.adoc
man/zinit-side.zsh.1:
@mkdir -p man
a2x --verbose -L --doctype manpage --format manpage -D man zinit-side.zsh.adoc
man/zinit-install.zsh.1:
@mkdir -p man
a2x --verbose -L --doctype manpage --format manpage -D man zinit-install.zsh.adoc
man/zinit-autoload.zsh.1:
@mkdir -p man
a2x --verbose -L --doctype manpage --format manpage -D man zinit-autoload.zsh.adoc
# PDFS
# Uses asciidoctor not a2x (i.e. not asciidoc)
pdf: pdf/zinit.zsh.pdf pdf/zinit-side.zsh.pdf pdf/zinit-install.zsh.pdf pdf/zinit-autoload.zsh.pdf
pdf/zinit.zsh.pdf:
@mkdir -p pdf
asciidoctor -a reproducible -b pdf -r asciidoctor-pdf -D pdf zinit.zsh.adoc
pdf/zinit-side.zsh.pdf:
@mkdir -p pdf
asciidoctor -a reproducible -b pdf -r asciidoctor-pdf -D pdf zinit-side.zsh.adoc
pdf/zinit-install.zsh.pdf:
@mkdir -p pdf
asciidoctor -a reproducible -b pdf -r asciidoctor-pdf -D pdf zinit-install.zsh.adoc
pdf/zinit-autoload.zsh.pdf:
@mkdir -p pdf
asciidoctor -a reproducible -b pdf -r asciidoctor-pdf -D pdf zinit-autoload.zsh.adoc
clean:
rm -rf man pdf data
.PHONY: man pdf clean
# vim:noet:sts=8:ts=8

View file

@ -1,22 +0,0 @@
# Code documentation
Here is `Asciidoc` code documentation generated using [Zshelldoc](https://github.com/zdharma-continuum/zshelldoc). There
are `4` Zinit's source files, the main one is [zinit.zsh](zinit.zsh.adoc). The documentation lists all functions,
interactions between them, their comments and features used.
Github allows to directly view `Asciidoc` documents:
- [zinit.zsh](zinit.zsh.adoc) always loaded, in `.zshrc`
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit.zsh))
- [zinit-side.zsh](zinit-side.zsh.adoc) common functions, loaded by `*-install` and `*-autoload` scripts
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-side.zsh))
- [zinit-install.zsh](zinit-install.zsh.adoc) functions used only when installing a plugin or snippet
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-install.zsh))
- [zinit-autoload.zsh](zinit-autoload.zsh.adoc) functions used only in interactive `Zinit` invocations
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-autoload.zsh/))
# PDFs, man pages, etc.
Formats other than `Asciidoc` can be produced by using provided Makefile. For example, issuing `make pdf` will create
and populate a new directory `pdf` (requires `asciidoctor`, install with `gem install asciidoctor-pdf --pre`).
`make man` will create man pages (requires package `asciidoc`, uses its command `a2x`, which is quite slow).

View file

@ -1,185 +0,0 @@
NAME
zinit-additional.zsh - a shell script
Documentation automatically generated with `zshelldoc'
== FUNCTIONS
+zinit-debug
.zinit-debug-clear
.zinit-debug-report
.zinit-debug-revert
.zinit-debug-start
.zinit-debug-status
.zinit-debug-stop
.zinit-service
.zinit-wrap-track-functions
:zinit-tmp-subst-source
=== DETAILS
==== Script Body
Has 1 line(s). No functions are called (may set up e.g. a hook, a Zle widget bound to a key, etc.).
==== +zinit-debug
____
Debug command entry point
____
Has 35 line(s). Doesn't call other functions.
Uses feature(s): _setopt_, _zmodload_, _zparseopts_
Called by:
zinit.zsh/zinit
==== .zinit-debug-clear
____
Clear latest debug report
____
Has 7 line(s). Calls functions:
.zinit-debug-clear
|-- zinit-autoload.zsh/.zinit-clear-report-for
`-- zinit.zsh/+zi-log
Called by:
zinit-autoload.zsh/.zinit-unload
==== .zinit-debug-report
____
Displays debug report (data recorded in interactive session).
____
Has 6 line(s). Calls functions:
.zinit-debug-report
|-- zinit-autoload.zsh/.zinit-show-report
`-- zinit.zsh/+zi-log
Uses feature(s): _source_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-debug-revert
____
Revert changes made during debug mode
____
Has 7 line(s). Calls functions:
.zinit-debug-revert
|-- zinit-autoload.zsh/.zinit-unload
`-- zinit.zsh/+zi-log
Uses feature(s): _source_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-debug-start
____
Start debug mode
____
Has 13 line(s). Calls functions:
.zinit-debug-start
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-diff
`-- zinit.zsh/.zinit-tmp-subst-on
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-debug-status
____
Revert changes made during debug mode
____
Has 2 line(s). Calls functions:
.zinit-debug-status
`-- zinit.zsh/+zi-log
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-debug-stop
____
Stop debug mode
____
Has 14 line(s). Calls functions:
.zinit-debug-stop
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-diff
`-- zinit.zsh/.zinit-tmp-subst-off
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-service
____
Handles given service, i.e. obtains lock, runs it, or waits if no lock
$1 - type "p" or "s" (plugin or snippet)
$2 - mode - for plugin (light or load)
$3 - id - URL or plugin ID or alias name (from id-as'')
____
Has 37 line(s). Calls functions:
.zinit-service
|-- zinit.zsh/.zinit-load
`-- zinit.zsh/.zinit-load-snippet
Uses feature(s): _kill_, _read_, _setopt_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-wrap-track-functions
Has 19 line(s). Doesn't call other functions.
Uses feature(s): _eval_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== :zinit-tmp-subst-source
Has 25 line(s). Calls functions:
:zinit-tmp-subst-source
`-- zinit.zsh/+zi-log
Uses feature(s): _eval_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).

File diff suppressed because it is too large Load diff

View file

@ -1,854 +0,0 @@
NAME
zinit-install.zsh - a shell script
Documentation automatically generated with `zshelldoc'
== FUNCTIONS
+zinit-cmake-hook
.zi::get-architecture
.zinit-at-eval
.zinit-compinit
.zinit-download-file-stdout
.zinit-download-snippet
.zinit-extract
.zinit-forget-completion
.zinit-get-cygwin-package
.zinit-get-latest-gh-r-url-part
.zinit-get-package
.zinit-get-url-mtime
.zinit-install-completions
.zinit-jq-check
.zinit-json-get-value
.zinit-json-to-array
.zinit-mirror-using-svn
.zinit-setup-plugin-dir
.zinit-single-line
.zinit-update-snippet
__zinit-cmake-base-hook
zicp
ziextract
zimv
∞zinit-atclone-hook
∞zinit-atpull-e-hook
∞zinit-atpull-hook
∞zinit-compile-plugin-hook
∞zinit-configure-base-hook
∞zinit-configure-e-hook
∞zinit-configure-hook
∞zinit-cp-hook
∞zinit-extract-hook
∞zinit-file-cp-mv-operation
∞zinit-make-base-hook
∞zinit-make-e-hook
∞zinit-make-ee-hook
∞zinit-make-hook
∞zinit-mv-hook
∞zinit-ps-on-update-hook
∞zinit-reset-hook
AUTOLOAD compinit
=== DETAILS
==== Script Body
Has 6 line(s). No functions are called (may set up e.g. a hook, a Zle widget bound to a key, etc.).
Uses feature(s): _source_
==== +zinit-cmake-hook
Has 1 line(s). Calls functions:
+zinit-cmake-hook
`-- __zinit-cmake-base-hook
`-- zinit.zsh/+zi-log
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zi::get-architecture
Has 39 line(s). Calls functions:
.zi::get-architecture
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-at-eval
Has 9 line(s). Calls functions:
.zinit-at-eval
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _eval_
Called by:
∞zinit-atpull-e-hook
∞zinit-atpull-hook
==== .zinit-compinit
____
User-exposed `compinit' frontend which first ensures that all
completions managed by Zinit are forgotten by Zshell. After
that it runs normal `compinit', which should more easily detect
Zinit's completions.
No arguments.
____
Has 26 line(s). Calls functions:
.zinit-compinit
|-- .zinit-forget-completion
|-- compinit
`-- zinit.zsh/+zi-log
Uses feature(s): _autoload_, _compinit_, _setopt_, _unfunction_
Called by:
.zinit-install-completions
zinit-autoload.zsh/.zinit-uninstall-completions
zinit-autoload.zsh/.zinit-update-or-status-all
zinit.zsh/.zinit-prepare-home
zinit.zsh/zinit
==== .zinit-download-file-stdout
____
Downloads file to stdout. Supports following backend commands:
curl, wget, lftp, lynx. Used by snippet loading.
____
Has 59 line(s). Calls functions:
.zinit-download-file-stdout
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_, _trap_, _type_
Called by:
.zinit-download-snippet
.zinit-get-cygwin-package
.zinit-get-package
.zinit-setup-plugin-dir
==== .zinit-download-snippet
____
Downloads snippet
file with curl, wget, lftp or lynx,
directory, with Subversion when svn-ICE is active.
Github supports Subversion protocol and allows to clone subdirectories.
This is used to provide a layer of support for Oh-My-Zsh and Prezto.
____
Has 377 line(s). Calls functions:
.zinit-download-snippet
|-- .zinit-download-file-stdout
|   `-- zinit.zsh/+zi-log
|-- .zinit-get-url-mtime
|-- .zinit-install-completions
|   |-- .zinit-compinit
|   |   |-- .zinit-forget-completion
|   |   |-- compinit
|   |   `-- zinit.zsh/+zi-log
|   |-- .zinit-forget-completion
|   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2
|   |-- zinit-side.zsh/.zinit-exists-physically-message
|   |-- zinit.zsh/+zi-log
|   `-- zinit.zsh/.zinit-any-to-user-plugin
|-- .zinit-mirror-using-svn
|   `-- zinit.zsh/.zinit-cd-quiet
|-- zinit-side.zsh/.zinit-store-ices
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-cd-quiet
`-- zinit.zsh/is-at-least
Uses feature(s): _is-at-least_, _setopt_, _trap_, _zcompile_
Called by:
.zinit-update-snippet
zinit.zsh/.zinit-load-snippet
==== .zinit-extract
Has 30 line(s). Calls functions:
.zinit-extract
|-- ziextract
|   `-- zinit.zsh/+zi-log
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_
Called by:
∞zinit-extract-hook
==== .zinit-forget-completion
____
Implements alternation of Zsh state so that already initialized
completion stops being visible to Zsh.
$1 - completion function name, e.g. "_cp"; can also be "cp"
____
Has 20 line(s). Doesn't call other functions.
Uses feature(s): _setopt_, _unfunction_
Called by:
.zinit-compinit
.zinit-install-completions
zinit-autoload.zsh/.zinit-uninstall-completions
zinit.zsh/zinit
==== .zinit-get-cygwin-package
Has 70 line(s). Calls functions:
.zinit-get-cygwin-package
|-- .zinit-download-file-stdout
|   `-- zinit.zsh/+zi-log
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_
Called by:
.zinit-setup-plugin-dir
==== .zinit-get-latest-gh-r-url-part
____
Gets version string of latest release of given Github
package. Connects to Github releases page.
____
Has 66 line(s). Calls functions:
.zinit-get-latest-gh-r-url-part
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_
Called by:
.zinit-setup-plugin-dir
zinit-autoload.zsh/.zinit-update-or-status
==== .zinit-get-package
Has 197 line(s). Calls functions:
.zinit-get-package
|-- .zinit-download-file-stdout
|   `-- zinit.zsh/+zi-log
|-- .zinit-jq-check
|   `-- zinit.zsh/+zi-log
|-- .zinit-json-to-array
|   `-- .zinit-jq-check
|   `-- zinit.zsh/+zi-log
|-- ziextract
|   `-- zinit.zsh/+zi-log
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _eval_, _setopt_, _trap_
Called by:
zinit.zsh/.zinit-load
==== .zinit-get-url-mtime
____
For the given URL returns the date in the Last-Modified
header as a time stamp
____
Has 35 line(s). Doesn't call other functions.
Uses feature(s): _read_, _setopt_, _trap_, _type_
Called by:
.zinit-download-snippet
==== .zinit-install-completions
____
Installs all completions of given plugin. After that they are visible to
'compinit'. Visible completions can be selectively disabled and enabled. User
can access completion data with 'completions' subcommand.
$1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
$2 - plugin if $1 (i.e., user) given
$3 - if 1, then reinstall, otherwise only install completions that are not present
____
Has 62 line(s). Calls functions:
.zinit-install-completions
|-- .zinit-compinit
|   |-- .zinit-forget-completion
|   |-- compinit
|   `-- zinit.zsh/+zi-log
|-- .zinit-forget-completion
|-- zinit-side.zsh/.zinit-any-colorify-as-uspl2
|-- zinit-side.zsh/.zinit-exists-physically-message
|-- zinit.zsh/+zi-log
`-- zinit.zsh/.zinit-any-to-user-plugin
Uses feature(s): _setopt_
Called by:
.zinit-download-snippet
.zinit-setup-plugin-dir
zinit.zsh/zinit
==== .zinit-jq-check
____
Check if jq is available and outputs an error message with instructions if
that's not the case
____
Has 8 line(s). Calls functions:
.zinit-jq-check
`-- zinit.zsh/+zi-log
Called by:
.zinit-get-package
.zinit-json-get-value
.zinit-json-to-array
==== .zinit-json-get-value
____
Wrapper around jq that return the value of a property
$1: JSON structure
$2: jq path
____
Has 4 line(s). Calls functions:
.zinit-json-get-value
`-- .zinit-jq-check
`-- zinit.zsh/+zi-log
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-json-to-array
____
Wrapper around jq that sets key/values of an associative array, replicating
the structure of a given JSON object
$1: JSON structure
$2: jq path
$3: name of the associative array to store the key/value pairs in
____
Has 13 line(s). Calls functions:
.zinit-json-to-array
`-- .zinit-jq-check
`-- zinit.zsh/+zi-log
Uses feature(s): _eval_, _setopt_
Called by:
.zinit-get-package
==== .zinit-mirror-using-svn
____
Used to clone subdirectories from Github. If in update mode
(see $2), then invokes `svn update', in normal mode invokes
`svn checkout --non-interactive -q <URL>'. In test mode only
compares remote and local revision and outputs true if update
is needed.
$1 - URL
$2 - mode, "" - normal, "-u" - update, "-t" - test
$3 - subdirectory (not path) with working copy, needed for -t and -u
____
Has 29 line(s). Calls functions:
.zinit-mirror-using-svn
`-- zinit.zsh/.zinit-cd-quiet
Uses feature(s): _setopt_
Called by:
.zinit-download-snippet
==== .zinit-setup-plugin-dir
____
Clones given plugin into PLUGIN_DIR. Supports multiple
sites (respecting `from' and `proto' ice modifiers).
Invokes compilation of plugin's main file.
$1 - user
$2 - plugin
____
Has 222 line(s). Calls functions:
.zinit-setup-plugin-dir
|-- .zinit-download-file-stdout
|   `-- zinit.zsh/+zi-log
|-- .zinit-get-cygwin-package
|   |-- .zinit-download-file-stdout
|   |   `-- zinit.zsh/+zi-log
|   `-- zinit.zsh/+zi-log
|-- .zinit-get-latest-gh-r-url-part
|   `-- zinit.zsh/+zi-log
|-- .zinit-install-completions
|   |-- .zinit-compinit
|   |   |-- .zinit-forget-completion
|   |   |-- compinit
|   |   `-- zinit.zsh/+zi-log
|   |-- .zinit-forget-completion
|   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2
|   |-- zinit-side.zsh/.zinit-exists-physically-message
|   |-- zinit.zsh/+zi-log
|   `-- zinit.zsh/.zinit-any-to-user-plugin
|-- ziextract
|   `-- zinit.zsh/+zi-log
|-- zinit-side.zsh/.zinit-any-colorify-as-uspl2
|-- zinit-side.zsh/.zinit-store-ices
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-cd-quiet
`-- zinit.zsh/.zinit-get-object-path
Uses feature(s): _setopt_, _trap_
Called by:
zinit-autoload.zsh/.zinit-update-or-status
zinit.zsh/.zinit-load
==== .zinit-single-line
____
Display cURL progress bar on a single line
____
Has 20 line(s). Doesn't call other functions.
Uses feature(s): _read_, _setopt_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== .zinit-update-snippet
Has 76 line(s). Calls functions:
.zinit-update-snippet
|-- .zinit-download-snippet
|   |-- .zinit-download-file-stdout
|   |   `-- zinit.zsh/+zi-log
|   |-- .zinit-get-url-mtime
|   |-- .zinit-install-completions
|   |   |-- .zinit-compinit
|   |   |   |-- .zinit-forget-completion
|   |   |   |-- compinit
|   |   |   `-- zinit.zsh/+zi-log
|   |   |-- .zinit-forget-completion
|   |   |-- zinit-side.zsh/.zinit-any-colorify-as-uspl2
|   |   |-- zinit-side.zsh/.zinit-exists-physically-message
|   |   |-- zinit.zsh/+zi-log
|   |   `-- zinit.zsh/.zinit-any-to-user-plugin
|   |-- .zinit-mirror-using-svn
|   |   `-- zinit.zsh/.zinit-cd-quiet
|   |-- zinit-side.zsh/.zinit-store-ices
|   |-- zinit.zsh/+zi-log
|   |-- zinit.zsh/.zinit-cd-quiet
|   `-- zinit.zsh/is-at-least
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-get-object-path
`-- zinit.zsh/.zinit-pack-ice
Uses feature(s): _eval_, _setopt_
Called by:
zinit-autoload.zsh/.zinit-update-or-status-snippet
==== __zinit-cmake-base-hook
____
FUNCTION: __zinit-cmake-base-hook [[[
A base common implementation of the cmake ice
____
Has 23 line(s). Calls functions:
__zinit-cmake-base-hook
`-- zinit.zsh/+zi-log
Uses feature(s): _eval_, _setopt_
Called by:
+zinit-cmake-hook
==== zicp
Has 30 line(s). Doesn't call other functions.
Uses feature(s): _setopt_
Called by:
zimv
==== ziextract
____
If the file is an archive, it is extracted by this function.
Executable permissions are determined solely by the execute bit already
stored in the archive — i.e. whatever the package author intended.
No heuristics (file(1), shebang scanning, etc.) are applied.
$1 - url
$2 - file
____
Has 284 line(s). Calls functions:
ziextract
`-- zinit.zsh/+zi-log
Uses feature(s): _setopt_, _unfunction_, _zparseopts_
Called by:
.zinit-extract
.zinit-get-package
.zinit-setup-plugin-dir
==== zimv
Has 3 line(s). Calls functions:
zimv
`-- zicp
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-atclone-hook
Has 22 line(s). Calls functions:
∞zinit-atclone-hook
|-- zinit-side.zsh/.zinit-countdown
|-- zinit.zsh/.zinit-cd-quiet
|-- zinit.zsh/.zinit-restore-dir
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _eval_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-atpull-e-hook
Has 20 line(s). Calls functions:
∞zinit-atpull-e-hook
|-- .zinit-at-eval
|   `-- zinit.zsh/@zinit-substitute
|-- zinit-side.zsh/.zinit-countdown
|-- zinit.zsh/.zinit-cd-quiet
`-- zinit.zsh/.zinit-restore-dir
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-atpull-hook
Has 20 line(s). Calls functions:
∞zinit-atpull-hook
|-- .zinit-at-eval
|   `-- zinit.zsh/@zinit-substitute
|-- zinit-side.zsh/.zinit-countdown
|-- zinit.zsh/.zinit-cd-quiet
`-- zinit.zsh/.zinit-restore-dir
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-compile-plugin-hook
Has 20 line(s). Calls functions:
∞zinit-compile-plugin-hook
`-- zinit-autoload.zsh/.zinit-compile-plugin
Uses feature(s): _setopt_, _source_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-configure-base-hook
____
A base common implementation of the configure ice
____
Has 49 line(s). Calls functions:
∞zinit-configure-base-hook
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-cd-quiet
|-- zinit.zsh/.zinit-restore-dir
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _eval_, _setopt_
Called by:
∞zinit-configure-e-hook
∞zinit-configure-hook
==== ∞zinit-configure-e-hook
Has 1 line(s). Calls functions:
∞zinit-configure-e-hook
`-- ∞zinit-configure-base-hook
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-cd-quiet
|-- zinit.zsh/.zinit-restore-dir
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-configure-hook
____
The non-! version of configure'' ice. Runs in between
of make'!' and make''. Configure script naturally runs
before make.
____
Has 1 line(s). Calls functions:
∞zinit-configure-hook
`-- ∞zinit-configure-base-hook
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-cd-quiet
|-- zinit.zsh/.zinit-restore-dir
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-cp-hook
Has 1 line(s). Calls functions:
∞zinit-cp-hook
`-- ∞zinit-file-cp-mv-operation
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-cd-quiet
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-extract-hook
Has 10 line(s). Calls functions:
∞zinit-extract-hook
|-- .zinit-extract
|   |-- ziextract
|   |   `-- zinit.zsh/+zi-log
|   `-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-file-cp-mv-operation
Has 49 line(s). Calls functions:
∞zinit-file-cp-mv-operation
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-cd-quiet
`-- zinit.zsh/@zinit-substitute
Called by:
∞zinit-cp-hook
∞zinit-mv-hook
==== ∞zinit-make-base-hook
____
A base common implementation of the make ice
____
Has 57 line(s). Calls functions:
∞zinit-make-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Uses feature(s): _eval_, _setopt_
Called by:
∞zinit-make-e-hook
∞zinit-make-ee-hook
∞zinit-make-hook
==== ∞zinit-make-e-hook
Has 1 line(s). Calls functions:
∞zinit-make-e-hook
`-- ∞zinit-make-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-make-ee-hook
Has 1 line(s). Calls functions:
∞zinit-make-ee-hook
`-- ∞zinit-make-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-make-hook
Has 1 line(s). Calls functions:
∞zinit-make-hook
`-- ∞zinit-make-base-hook
|-- zinit.zsh/+zi-log
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-mv-hook
Has 1 line(s). Calls functions:
∞zinit-mv-hook
`-- ∞zinit-file-cp-mv-operation
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-cd-quiet
`-- zinit.zsh/@zinit-substitute
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-ps-on-update-hook
Has 18 line(s). Calls functions:
∞zinit-ps-on-update-hook
`-- zinit.zsh/+zi-log
Uses feature(s): _eval_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== ∞zinit-reset-hook
Has 79 line(s). Calls functions:
∞zinit-reset-hook
`-- zinit.zsh/+zi-log
Uses feature(s): _eval_
Not called by script or any function (may be e.g. a hook, a Zle widget, etc.).
==== compinit
____
Initialisation for new style completion. This mainly contains some helper
functions and setup. Everything else is split into different files that
will automatically be made autoloaded (see the end of this file). The
names of the files that will be considered for autoloading are those that
begin with an underscores (like `_condition).
The first line of each of these files is read and must indicate what
should be done with its contents:
`#compdef <names ...>'
____
Has 573 line(s). Doesn't call other functions.
Uses feature(s): _autoload_, _bindkey_, _compdef_, _compdump_, _eval_, _read_, _setopt_, _unfunction_, _zle_, _zstyle_
Called by:
.zinit-compinit

View file

@ -1,285 +0,0 @@
NAME
zinit-side.zsh - a shell script
Documentation automatically generated with `zshelldoc'
== FUNCTIONS
.zinit-any-colorify-as-uspl2
.zinit-compute-ice
.zinit-countdown
.zinit-exists-physically
.zinit-exists-physically-message
.zinit-first
.zinit-store-ices
.zinit-two-paths
=== DETAILS
==== Script Body
Has 1 line(s). No functions are called (may set up e.g. a hook, a Zle widget bound to a key, etc.).
==== .zinit-any-colorify-as-uspl2
____
Returns ANSI-colorified "user/plugin" string, from any supported
plugin spec (user---plugin, user/plugin, user plugin, plugin).
$1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
$2 - plugin (only when $1 - i.e. user - given)
$REPLY - ANSI-colorified "user/plugin" string
____
Has 22 line(s). Calls functions:
.zinit-any-colorify-as-uspl2
|-- zinit.zsh/.zinit-any-to-pid
`-- zinit.zsh/.zinit-any-to-user-plugin
Called by:
.zinit-exists-physically-message
zinit-autoload.zsh/.zinit-clear-completions
zinit-autoload.zsh/.zinit-compiled
zinit-autoload.zsh/.zinit-create
zinit-autoload.zsh/.zinit-exists-message
zinit-autoload.zsh/.zinit-get-completion-owner-uspl2col
zinit-autoload.zsh/.zinit-list-bindkeys
zinit-autoload.zsh/.zinit-recently
zinit-autoload.zsh/.zinit-search-completions
zinit-autoload.zsh/.zinit-show-completions
zinit-autoload.zsh/.zinit-show-times
zinit-autoload.zsh/.zinit-unload
zinit-autoload.zsh/.zinit-update-all-parallel
zinit-autoload.zsh/.zinit-update-or-status-all
zinit-autoload.zsh/.zinit-update-or-status
zinit-install.zsh/.zinit-install-completions
zinit-install.zsh/.zinit-setup-plugin-dir
zinit.zsh/.zinit-formatter-pid
==== .zinit-compute-ice
____
Computes ICE array
- input
- static
- saved
taking priorities into account.
Can also pack resulting ices into ZINIT_SICE (see $2).
Returns filepath to snippet directory and optional snippet file name (only
valid if ICE[svn] is not set).
$1 - URL (also plugin-spec)
$2 - "pack" or "nopack" or "pack-nf" - packing means ICE
wins with static ice; "pack-nf" means that disk-ices will
be ignored (no-file?)
$3 - name of output associative array, "ICE" is the default
$4 - name of output string parameter, to hold path to directory ("local_dir")
$5 - name of output string parameter, to hold filename ("filename")
$6 - name of output string parameter, to hold is-snippet 0/1-bool ("is_snippet")
$REPLY - snippet directory filepath
____
Has 110 line(s). Calls functions:
.zinit-compute-ice
|-- .zinit-exists-physically-message
|   |-- .zinit-any-colorify-as-uspl2
|   |   |-- zinit.zsh/.zinit-any-to-pid
|   |   `-- zinit.zsh/.zinit-any-to-user-plugin
|   |-- .zinit-exists-physically
|   |   `-- zinit.zsh/.zinit-any-to-user-plugin
|   |-- zinit.zsh/+zi-log
|   |-- zinit.zsh/.zinit-any-to-pid
|   `-- zinit.zsh/.zinit-any-to-user-plugin
|-- .zinit-two-paths
|   |-- .zinit-first
|   |   |-- zinit.zsh/.zinit-any-to-pid
|   |   |-- zinit.zsh/.zinit-any-to-user-plugin
|   |   |-- zinit.zsh/.zinit-find-other-matches
|   |   `-- zinit.zsh/.zinit-get-object-path
|   `-- zinit.zsh/.zinit-get-object-path
|-- zinit.zsh/.zinit-any-to-user-plugin
`-- zinit.zsh/.zinit-pack-ice
Uses feature(s): _setopt_
Called by:
zinit-autoload.zsh/.zinit-compile-plugin
zinit-autoload.zsh/.zinit-edit
zinit-autoload.zsh/.zinit-recall
zinit-autoload.zsh/.zinit-uncompile-plugin
zinit-autoload.zsh/.zinit-update-or-status-snippet
zinit-autoload.zsh/.zinit-update-or-status
==== .zinit-countdown
____
Displays a countdown 5...4... etc.
$REPLY - 1 if Ctrl-C is pressed, otherwise 0
____
Has 20 line(s). Calls functions:
.zinit-countdown
`-- zinit.zsh/+zi-log
Uses feature(s): _trap_
Called by:
zinit-install.zsh/∞zinit-atclone-hook
zinit-install.zsh/∞zinit-atpull-e-hook
zinit-install.zsh/∞zinit-atpull-hook
==== .zinit-exists-physically
____
Checks if directory of given plugin exists in PLUGIN_DIR.
$1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
$2 - plugin (only when $1 - i.e. user - given)
____
Has 8 line(s). Calls functions:
.zinit-exists-physically
`-- zinit.zsh/.zinit-any-to-user-plugin
Called by:
.zinit-exists-physically-message
zinit-autoload.zsh/.zinit-create
zinit-autoload.zsh/.zinit-update-or-status
==== .zinit-exists-physically-message
____
Checks if directory of given plugin exists in PLUGIN_DIR, and outputs error
message if it doesn't.
$1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
$2 - plugin (only when $1 - i.e. user - given)
____
Has 25 line(s). Calls functions:
.zinit-exists-physically-message
|-- .zinit-any-colorify-as-uspl2
|   |-- zinit.zsh/.zinit-any-to-pid
|   `-- zinit.zsh/.zinit-any-to-user-plugin
|-- .zinit-exists-physically
|   `-- zinit.zsh/.zinit-any-to-user-plugin
|-- zinit.zsh/+zi-log
|-- zinit.zsh/.zinit-any-to-pid
`-- zinit.zsh/.zinit-any-to-user-plugin
Uses feature(s): _setopt_
Called by:
.zinit-compute-ice
zinit-autoload.zsh/.zinit-changes
zinit-autoload.zsh/.zinit-glance
zinit-autoload.zsh/.zinit-stress
zinit-autoload.zsh/.zinit-update-or-status
zinit-install.zsh/.zinit-install-completions
==== .zinit-first
____
Finds the main file of plugin. There are multiple file name formats, they are
ordered in order starting from more correct ones, and matched.
.zinit-load-plugin() has similar code parts and doesn't call .zinit-first()
for performance. Obscure matching is done in .zinit-find-other-matches, here
and in .zinit-load(). Obscure = non-standard main-file naming convention.
$1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
$2 - plugin (only when $1 - i.e. user - given)
____
Has 20 line(s). Calls functions:
.zinit-first
|-- zinit.zsh/.zinit-any-to-pid
|-- zinit.zsh/.zinit-any-to-user-plugin
|-- zinit.zsh/.zinit-find-other-matches
`-- zinit.zsh/.zinit-get-object-path
Called by:
.zinit-two-paths
zinit-autoload.zsh/.zinit-compile-plugin
zinit-autoload.zsh/.zinit-glance
zinit-autoload.zsh/.zinit-stress
==== .zinit-store-ices
____
Saves ice mods in given hash onto disk.
$1 - directory where to create or delete files
$2 - name of hash that holds values
$3 - additional keys of hash to store, space separated
$4 - additional keys of hash to store, empty-meaningful ices, space separated
$5 URL, if applicable
$6 mode, svn=1, 0=single file
____
Has 30 line(s). Doesn't call other functions.
Called by:
zinit-autoload.zsh/.zinit-update-or-status
zinit-install.zsh/.zinit-download-snippet
zinit-install.zsh/.zinit-setup-plugin-dir
==== .zinit-two-paths
____
Obtains a snippet URL without specification if it is an SVN URL (points to
directory) or regular URL (points to file), returns 2 possible paths for
further examination
$REPLY - two filepaths
____
Has 24 line(s). Calls functions:
.zinit-two-paths
|-- .zinit-first
|   |-- zinit.zsh/.zinit-any-to-pid
|   |-- zinit.zsh/.zinit-any-to-user-plugin
|   |-- zinit.zsh/.zinit-find-other-matches
|   `-- zinit.zsh/.zinit-get-object-path
`-- zinit.zsh/.zinit-get-object-path
Uses feature(s): _setopt_
Called by:
.zinit-compute-ice
zinit-autoload.zsh/.zinit-update-or-status

File diff suppressed because it is too large Load diff

View file

@ -1,41 +0,0 @@
ARG VERSION=latest
FROM alpine:${VERSION}
ARG PUSERNAME=user01
ARG PUID=1000
ARG PGID=1000
ARG TERM=xterm-256color
ARG ZINIT_ZSH_VERSION
ENV PUSERNAME=${PUSERNAME} PUID=${PUID} PGID=${PGID} \
SHELL=/bin/zsh TERM=${TERM} ZINIT_ZSH_VERSION=${ZINIT_ZSH_VERSION}
RUN apk --no-cache --virtual base add \
coreutils curl git libuser rsync sudo zsh && \
apk --no-cache --virtual zsh-build-tools add \
autoconf bash build-base ncurses-dev && \
apk --no-cache --virtual dev-tools add \
go jq nodejs-dev npm ruby-dev neovim
RUN sed -ir 's#^(root:.+):/bin/ash#\1:/bin/zsh#' /etc/passwd && \
adduser -D -s /bin/zsh -u "${PUID}" -h "/home/${PUSERNAME}" \
"${PUSERNAME}" && \
printf "${PUSERNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/user && \
mkdir -p /src /data /data-static && \
chown -R "${PUID}:${PGID}" /data /data-static && \
ln -sfv /src/docker/zshenv /home/${PUSERNAME}/.zshenv && \
ln -sfv /src/docker/zshrc /home/${PUSERNAME}/.zshrc
WORKDIR /home/${PUSERNAME}
VOLUME ["/src", "/data"]
COPY --chown=${PUSERNAME} . /src
USER ${PUSERNAME}
# Fetch keys config and store it outside of ZINIT[HOME_DIR] since it might get
# overridden at runtime (the /data volume)
RUN ZINIT_HOME_DIR=/data-static ZSH_NO_INIT=1 \
zsh -ils -c -- '@zinit-scheduler burst'
CMD ["/bin/zsh"]

View file

@ -1,26 +0,0 @@
# Fix permissions on /data
if [[ -z "$QUIET" ]]
then
echo "Setting owner of /data to ${PUID}:${PGID}" >&2
fi
sudo chown "${PUID}:${PGID}" /data
sudo chown -R "${PUID}:${PGID}" /data
# sync files between /data-static and /data
if [[ -z "$NOTHING_FANCY" ]]
then
if [[ -z "$QUIET" ]]
then
echo "Copying files from /data-static to /data" >&2
fi
rsync -raq /data-static/ /data
fi
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View file

@ -1,69 +0,0 @@
#!/usr/bin/env zsh
zinit::setup() {
source /src/zinit.zsh
}
zinit::reload() {
local zf
for zf in /src/*.zsh
do
source "$zf"
done
}
zinit::setup-keys() {
zinit snippet OMZL::key-bindings.zsh
}
zinit::setup-annexes() {
zinit light-mode compile'*handler' for \
zdharma-continuum/zinit-annex-bin-gem-node \
zdharma-continuum/zinit-annex-default-ice \
zdharma-continuum/zinit-annex-meta-plugins \
zdharma-continuum/zinit-annex-patch-dl \
zdharma-continuum/zinit-annex-readurl \
zdharma-continuum/zinit-annex-rust \
zdharma-continuum/zinit-annex-submods \
zdharma-continuum/zinit-annex-unscope
}
zinit::setup-annexes-extra() {
# Dependencies
sudo apk add ruby-dev grep tree
zinit::install-zshelldoc
zinit light-mode compile'*handler' for \
zdharma-continuum/zinit-annex-man \
zdharma-continuum/zinit-annex-test
}
zinit::install-zshelldoc() {
zinit light-mode \
make"PREFIX=$ZPFX install" \
for zdharma-continuum/zshelldoc
}
zinit::setup-minimal() {
zinit wait lucid light-mode for \
atinit"zicompinit; zicdreplay" \
zdharma-continuum/fast-syntax-highlighting \
atload"_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions \
blockf atpull'zinit creinstall -q .' \
zsh-users/zsh-completions
}
zinit::pack-zsh() {
local version="$1"
zinit pack"$version" for zsh
}
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View file

@ -1,21 +0,0 @@
# Make sure TERM is set
# Without a TERM value some ices might be ignored
# https://github.com/zdharma-continuum/zinit/issues/97
export TERM=${TERM:-xterm-256color}
# Set SHELL
export SHELL=${SHELL:-${commands[zsh]}}
typeset -Ag ZINIT
# ZINIT_HOME_DIR is used at build time to force the installation of plugins
# etc to /data-static
export ZINIT[HOME_DIR]=${ZINIT_HOME_DIR:-/data}
export ZINIT[BIN_DIR]=/src
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View file

@ -1,41 +0,0 @@
# Initialization. Trigger stuff that only needs to be run once, at startup.
if [[ "$$" == 1 ]] && [[ -z "$ZSH_NO_INIT" ]]
then
source /src/docker/init.zsh
fi
# load zinit
source /src/zinit.zsh
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# load zinit setup utility functions
source /src/docker/utils.zsh
# Add ZPFX/bin and GOPATH/bin to PATH
typeset -U path
path=("${ZPFX:-${HOME}/.local/share/zinit/polaris}/bin" "${HOME}/go/bin" $path)
# Install custom zsh version
if [[ -n "$ZINIT_ZSH_VERSION" ]]
then
zinit::pack-zsh "$ZINIT_ZSH_VERSION"
fi
source /src/docker/zshrc-fancy
# Source init file
INIT_FILE="/init.zsh"
if [[ -r "$INIT_FILE" ]]
then
source "$INIT_FILE"
fi
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View file

@ -1,39 +0,0 @@
[[ -n "$NOTHING_FANCY" ]] && return
# Annexes
zinit::setup-annexes
# Setup keys
zinit::setup-keys
# Aliases
alias ls="ls --color=auto"
alias vim="nvim"
alias re-init="source /init.zsh"
# History
HISTFILE=${HOME}/.local/share/zsh/history
HISTSIZE=1000
SAVEHIST=1000
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_verify
setopt share_history
mkdir -p ${HISTFILE:A:h}
# Completions
autoload -Uz compinit
compinit
zinit cdreplay -q
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

123
git-process-output.zsh Executable file
View file

@ -0,0 +1,123 @@
#!/usr/bin/env zsh
emulate -LR zsh -o typesetsilent -o extendedglob -o warncreateglobal
# Alpine Linux doesn't have tput; FreeBSD and Dragonfly BSD have termcap
if whence tput &> /dev/null; then
if [[ $OSTYPE == freebsd* ]] || [[ $OSTYPE == dragonfly* ]]; then
# termcap commands
ZPLG_CNORM='tput ve'
ZPLG_CIVIS='tput vi'
else
# terminfo is more common
ZPLG_CNORM='tput cnorm'
ZPLG_CIVIS='tput civis'
fi
fi
if (( $+ZPLG_CNORM )); then
trap $ZPLG_CNORM EXIT
trap $ZPLG_CNORM INT
trap $ZPLG_CNORM TERM
fi
local first=1
# Code by leoj3n
timeline() {
local sp='▚▞'; sp="${sp:$2%2:1}"
local bar="$(print -f "%-$2s▓%$(($3-$2))s" "${sp}" "${sp}")"
print -f "%s %s" "${bar// /░}" ""
}
# $1 - n. of objects
# $2 - packed objects
# $3 - total objects
# $4 - receiving percentage
# $5 - resolving percentage
print_my_line() {
print -nr -- "OBJ: $1, PACKED: $2/$3${${4:#...}:+, RECEIV.: $4%}${${5:#...}:+, RESOLV.: $5%} "
print -n $'\015'
}
print_my_line_compress() {
print -nr -- "OBJ: $1, PACKED: $2/$3, COMPR.: $4%${${5:#...}:+, RECEIV.: $5%}${${6:#...}:+, RESOL.: $6%} "
print -n $'\015'
}
integer have_1_counting=0 have_2_total=0 have_3_receiving=0 have_4_deltas=0 have_5_compress=0
integer counting_1=0 total_2=0 total_packed_2=0 receiving_3=0 deltas_4=0 compress_5=0
integer loop_count=0
IFS=''
(( $+ZPLG_CIVIS )) && eval $ZPLG_CIVIS
{ command perl -pe 'BEGIN { $|++; $/ = \1 }; tr/\r/\n/' || \
gstdbuf -o0 gtr '\r' '\n' || \
cat } |& \
while read -r line; do
(( ++ loop_count ))
if [[ "$line" = "Cloning into"* ]]; then
print; print $line
continue
elif [[ "$line" = (#i)*user*name* || "$line" = (#i)*password* ]]; then
print; print $line
continue
elif [[ "$line" = remote:*~*(Counting|Total|Compressing|Enumerating)* || "$line" = fatal:* ]]; then
print $line
continue
fi
if [[ "$line" = (#b)"remote: Counting objects:"[\ ]#([0-9]##)(*) ]]; then
have_1_counting=1
counting_1="${match[1]}"
fi
if [[ "$line" = (#b)"remote: Enumerating objects:"[\ ]#([0-9]##)(*) ]]; then
have_1_counting=1
counting_1="${match[1]}"
fi
if [[ "$line" = (#b)*"remote: Total"[\ ]#([0-9]##)*"pack-reused"[\ ]#([0-9]##)* ]]; then
have_2_total=1
total_2="${match[1]}" total_packed_2="${match[2]}"
fi
if [[ "$line" = (#b)"Receiving objects:"[\ ]#([0-9]##)%* ]]; then
have_3_receiving=1
receiving_3="${match[1]}"
fi
if [[ "$line" = (#b)"Resolving deltas:"[\ ]#([0-9]##)%* ]]; then
have_4_deltas=1
deltas_4="${match[1]}"
fi
if [[ "$line" = (#b)"remote: Compressing objects:"[\ ]#([0-9]##)"%"(*) ]]; then
have_5_compress=1
compress_5="${match[1]}"
fi
if (( loop_count >= 2 )); then
integer pr
(( pr = have_4_deltas ? deltas_4 / 10 : (
have_3_receiving ? receiving_3 / 10 : (
have_5_compress ? compress_5 / 10 : ( ( ( loop_count - 1 ) / 14 ) % 10 ) + 1 ) ) ))
timeline "" $pr 11
if (( have_5_compress )); then
print_my_line_compress "${${${(M)have_1_counting:#1}:+$counting_1}:-...}" \
"${${${(M)have_2_total:#1}:+$total_packed_2}:-0}" \
"${${${(M)have_2_total:#1}:+$total_2}:-0}" \
"${${${(M)have_5_compress:#1}:+$compress_5}:-...}" \
"${${${(M)have_3_receiving:#1}:+$receiving_3}:-...}" \
"${${${(M)have_4_deltas:#1}:+$deltas_4}:-...}"
else
print_my_line "${${${(M)have_1_counting:#1}:+$counting_1}:-...}" \
"${${${(M)have_2_total:#1}:+$total_packed_2}:-0}" \
"${${${(M)have_2_total:#1}:+$total_2}:-0}" \
"${${${(M)have_3_receiving:#1}:+$receiving_3}:-...}" \
"${${${(M)have_4_deltas:#1}:+$deltas_4}:-...}"
fi
fi
done
print
(( $+ZPLG_CNORM )) && eval $ZPLG_CNORM
unset ZPLG_CNORM ZPLG_CIVIS

View file

@ -1,81 +0,0 @@
#!/usr/bin/env bash
build() {
cd "$(
cd "$(dirname "$0")" > /dev/null 2>&1
pwd -P
)" || exit 9
local image_name="${1:-zinit}"
local tag="${2:-latest}"
local zsh_version="${3}"
shift 3
local dockerfile="../docker/Dockerfile"
if [[ -n $zsh_version ]]; then
tag="zsh${zsh_version}-${tag}"
fi
echo -e "\e[34mBuilding image: ${image_name}\e[0m" >&2
local -a args
[[ -n $NO_CACHE ]] && args+=(--no-cache "$@")
if docker build \
--build-arg "PUSERNAME=$(id -u -n)" \
--build-arg "PUID=$(id -u)" \
--build-arg "PGID=$(id -g)" \
--build-arg "TERM=${TERM:-xterm-256color}" \
--build-arg "ZINIT_ZSH_VERSION=${zsh_version}" \
--file "$dockerfile" \
--tag "${image_name}:${tag}" \
"${args[@]}" \
"$(realpath ..)"; then
{
echo -e "\e[34mTo use this image for zunit tests run: \e[0m"
echo -e "\e[34mexport CONTAINER_IMAGE=\"${image_name}\" CONTAINER_TAG=\"${tag}\"\e[0m"
echo -e "\e[34mzunit run --verbose\e[0m"
} >&2
else
echo -e "\e[31m❌ Container failed to build.\e[0m" >&2
return 1
fi
}
if [[ ${BASH_SOURCE[0]} == "${0}" ]]; then
BUILD_ZSH_VERSION="${BUILD_ZSH_VERSION:-}"
CONTAINER_IMAGE="${CONTAINER_IMAGE:-ghcr.io/zdharma-continuum/zinit}"
CONTAINER_TAG="${CONTAINER_TAG:-latest}"
NO_CACHE="${NO_CACHE:-}"
while [[ -n $* ]]; do
case "$1" in
--image | -i)
CONTAINER_IMAGE="$2"
shift 2
;;
--no-cache | -N)
NO_CACHE=1
shift
;;
--zsh-version | -zv | --zv)
BUILD_ZSH_VERSION="${2}"
shift 2
;;
*)
break
;;
esac
done
build "${CONTAINER_IMAGE}" "${CONTAINER_TAG}" "${BUILD_ZSH_VERSION}" "$@"
fi
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=bash sw=2 ts=2 et

View file

@ -1,260 +0,0 @@
#!/usr/bin/env bash
parent_process() {
local ppid pcmd
ppid="$(ps -o ppid= -p "$$" | awk '{ print $1 }')"
if [[ -z $ppid ]]; then
echo "Failed to determine parent process" >&2
return 1
fi
if pcmd="$(ps -o cmd= -p "$ppid")"; then
echo "$pcmd"
return
fi
return 1
}
running_interactively() {
if [[ -n $CI ]]; then
return 1
fi
if ! [[ -t 1 ]]; then
# return false if running non-interactively, unless run with zunit
parent_process | grep -q zunit
fi
}
create_init_config_file() {
local tempfile
if [[ -z $* ]]; then
return 1
fi
tempfile="$(mktemp)"
echo "$*" > "$tempfile"
# DIRTYFIX perms...
chmod 666 "$tempfile"
echo "$tempfile"
}
run() {
local image="${CONTAINER_IMAGE:-ghcr.io/zdharma-continuum/zinit}"
local tag="${CONTAINER_TAG:-latest}"
local init_config="$1"
shift
local -a args=(--rm)
local cruntime=docker
local sudo_cmd
if [[ -z $CI ]] && command -v podman > /dev/null 2>&1; then
cruntime=podman
# rootless containers are a PITA
# https://www.tutorialworks.com/podman-rootless-volumes/
sudo_cmd=sudo
fi
if running_interactively; then
args+=(--tty=true --interactive=true)
fi
if [[ -n $init_config ]]; then
if [[ -r $init_config ]]; then
args+=(--volume "${init_config}:/init.zsh")
else
echo "❌ Init config file is not readable" >&2
return 1
fi
fi
if [[ -n $CONTAINER_WORKDIR ]]; then
args+=(--workdir "$CONTAINER_WORKDIR")
fi
# Inherit TERM
if [[ -n $TERM ]]; then
args+=(--env "TERM=${TERM}")
fi
if [[ -n ${CONTAINER_ENV[*]} ]]; then
local e
for e in "${CONTAINER_ENV[@]}"; do
args+=(--env "${e}")
done
fi
if [[ -n ${CONTAINER_VOLUMES[*]} ]]; then
local vol
for vol in "${CONTAINER_VOLUMES[@]}"; do
# shellcheck disable=2076
if [[ ! " ${args[*]} " =~ " --volume ${vol} " ]]; then
args+=(--volume "${vol}")
fi
done
fi
local -a cmd=("$@")
if [[ -n $WRAP_CMD ]]; then
local zsh_opts="ilsc"
[[ -n $ZSH_DEBUG ]] && zsh_opts="x${zsh_opts}"
cmd=(zsh "-${zsh_opts}" "${cmd[*]}")
fi
if [[ -n $DEBUG ]]; then
{
# The @Q below is necessary to keep the quotes intact
# https://stackoverflow.com/a/12985353/1872036
echo -e "🚀 \e[35mRunning command"
echo -e "\$ ${cruntime} run ${args[*]} ${image}:${tag} ${cmd[*]@Q}\e[0m"
} >&2
fi
${sudo_cmd} "${cruntime}" run "${args[@]}" "${image}:${tag}" "${cmd[@]}"
}
if [[ ${BASH_SOURCE[0]} == "${0}" ]]; then
CONTAINER_ENV=()
CONTAINER_IMAGE="${CONTAINER_IMAGE:-ghcr.io/zdharma-continuum/zinit}"
CONTAINER_TAG="${CONTAINER_TAG:-latest}"
CONTAINER_VOLUMES=()
CONTAINER_WORKDIR="${CONTAINER_WORKDIR:-}"
DEBUG="${DEBUG:-}"
INIT_CONFIG_VAL="${INIT_CONFIG_VAL:-}"
PRESET="${PRESET:-}"
WRAP_CMD="${WRAP_CMD:-}"
ZSH_DEBUG="${ZSH_DEBUG:-}"
while [[ -n $* ]]; do
case "$1" in
# Fetch init config from clipboard (Linux only)
--xsel | -b)
INIT_CONFIG_VAL="$(xsel -b)"
shift
;;
-c | --config | --init-config | --init)
INIT_CONFIG_VAL="$2"
shift 2
;;
-f | --config-file | --init-config-file | --file)
if ! [[ -r $2 ]]; then
echo "Unable to read from file: $2" >&2
exit 2
fi
INIT_CONFIG_VAL="$(cat "$2")"
shift 2
;;
-d | --debug)
DEBUG=1
shift
;;
-D | --dev | --devel)
DEVEL=1
shift
;;
--docs)
PRESET=docs
shift
;;
-i | --image)
CONTAINER_IMAGE="$2"
shift 2
;;
-t | --tag)
CONTAINER_TAG="$2"
shift 2
;;
# Additional container env vars
-e | --env | --environment)
CONTAINER_ENV+=("$2")
shift 2
;;
# Additional container volumes
-v | --volume)
CONTAINER_VOLUMES+=("$2")
shift 2
;;
# Whether to wrap the command in zsh -silc
-w | --wrap)
WRAP_CMD=1
shift
;;
--tests | --zunit | -z)
PRESET=zunit
shift
;;
# Whether to enable debug tracing of zinit (zsh -x)
# Only applies to wrapped commands (--w|--wrap)
--zsh-debug | -x | -Z)
ZSH_DEBUG=1
shift
;;
*)
break
;;
esac
done
GIT_ROOT_DIR="$(git rev-parse --show-toplevel)"
CMD=("$@")
case "$PRESET" in
zunit)
# Mount root of the repo to /src
# Mount /tmp/zunit-zinit to /data
CONTAINER_VOLUMES+=(
"${GIT_ROOT_DIR}:/src"
"${TMPDIR:-/tmp}/zunit-zinit:/data"
)
CONTAINER_ENV+=(
"QUIET=1"
"NOTHING_FANCY=1"
)
;;
docs)
# Mount root of the repo to /src
CONTAINER_VOLUMES+=(
"${GIT_ROOT_DIR}:/src"
)
CONTAINER_ENV+=(
"QUIET=1"
"NOTHING_FANCY=1"
"LC_ALL=en_US.UTF-8"
)
CONTAINER_WORKDIR=/src
# shellcheck disable=2016
INIT_CONFIG_VAL='zinit nocompile make'\''prefix=$ZPFX all install'\'' for zdharma-continuum/zshelldoc'
# shellcheck disable=2016
CMD=(zsh -ilsc
'sudo chown -R "$(id -u):$(id -g)" /src &&
@zinit-scheduler burst &&
sudo apk add tree &&
make -C /src doc')
;;
esac
if INIT_CONFIG="$(create_init_config_file "$INIT_CONFIG_VAL")"; then
trap 'rm -vf $INIT_CONFIG' EXIT INT
fi
if [[ -n $DEVEL ]]; then
# Mount root of the repo to /src
CONTAINER_VOLUMES+=(
"${GIT_ROOT_DIR}:/src"
)
fi
run "$INIT_CONFIG" "${CMD[@]}"
fi
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=bash sw=2 ts=2 et

View file

@ -1,333 +0,0 @@
#!/usr/bin/env bash
{ # Colors
COLOR_RESET=''
COLOR_BOLD_RED=''
COLOR_BOLD_GREEN=''
COLOR_BOLD_YELLOW=''
COLOR_BOLD_BLUE=''
COLOR_BOLD_MAGENTA=''
COLOR_BOLD_CYAN=''
# The over-the-top fancy ones
COLOR_PALE_MAGENTA=''
COLOR_BOLD_WHITE_ON_BLACK=''
}
echo_fancy() {
emoji="$1"
color="$2"
shift 2
msg=""
# prepend emoji, unless NO_EMOJI is set
if [ -z "$NO_EMOJI" ]; then
msg="$emoji"
fi
# wrap every word in color (needed in case there are custom colors in
# the message itself), unless NO_COLOR is set
for str in "$@"; do
# FIXME: NO_COLOR only applies if there are no colors in the msg
if [ -z "$NO_COLOR" ]; then
msg="${msg}${color}"
fi
msg="${msg}${str}"
done
# Actual output
echo "${msg}${COLOR_RESET}" >&2
# fake "local" vars
unset emoji color str msg
}
echo_info() {
echo_fancy "🔵" "${COLOR_BOLD_BLUE}" "INFO: ${*}"
}
echo_success() {
echo_fancy "✅" "${COLOR_BOLD_GREEN}" "SUCCESS: ${*}"
}
echo_warning() {
echo_fancy "🚧" "${COLOR_BOLD_YELLOW}" "WARNING: ${*}"
}
echo_error() {
echo_fancy "❌" "${COLOR_BOLD_RED}" "ERROR: ${*}"
}
check_dependencies() {
zsh_min_version=5.8
if ! zsh -sfc \
'autoload is-at-least;
is-at-least $1 $ZSH_VERSION' "$zsh_min_version"; then
echo_warning "ZSH version 5.5+ is recommended for zinit." \
"It'll still work, but be warned."
fi
if ! command -v git > /dev/null 2>&1; then
echo_error "${COLOR_BOLD_GREEN}git${COLOR_RESET} is not installed"
exit 1
fi
unset zsh_min_version
}
show_environment() {
echo_info "About to setup zinit from $ZINIT_REPO" \
"(branch: $ZINIT_BRANCH - commit: ${ZINIT_COMMIT:-N/A})" \
"to ${ZINIT_INSTALL_DIR}"
}
create_zinit_home() {
if ! test -d "${ZINIT_HOME}"; then
mkdir -p "${ZINIT_HOME}"
chmod g-w "${ZINIT_HOME}"
chmod o-w "${ZINIT_HOME}"
fi
}
create_zinit_tmpdir() {
# use -d instead of --directory for macos (BSD) compatibility
ZINIT_TMPDIR="$(mktemp -d)"
if [ ! -d "$ZINIT_TMPDIR" ]; then
echo_error "Tempdir creation failed. This ain't good"
exit 1
fi
trap 'rm -rvf "$ZINIT_TMPDIR"' EXIT INT
}
# Get the download-progress bar tool
download_git_output_processor() {
url="https://raw.githubusercontent.com/${ZINIT_REPO}/${ZINIT_COMMIT:-${ZINIT_BRANCH}}/share/git-process-output.zsh"
script_path="${ZINIT_TMPDIR}/git-process-output.zsh"
echo_info "Fetching git-process-output.zsh from $url"
if command -v curl > /dev/null 2>&1; then
curl -fsSL -o "$script_path" "$url"
elif command -v wget > /dev/null 2>&1; then
wget -q -O "$script_path" "$url"
fi
# shellcheck disable=2181
if [ "$?" -eq 0 ]; then
chmod a+x "$script_path" 2> /dev/null
echo_success 'Download finished!'
else
echo_warning "Download failed."
fi
unset url script_path
}
zinit_git_exec() {
command git -C "${ZINIT_INSTALL_DIR}" "$@"
}
zinit_checkout_ref() {
ref="${ZINIT_BRANCH}"
git_obj_type="branch"
if [ -n "$ZINIT_COMMIT" ]; then
ref="$ZINIT_COMMIT"
git_obj_type="commit"
fi
if zinit_git_exec checkout "$ref" > /dev/null 2>&1; then
echo_success "Checked out $git_obj_type $ref"
else
echo_error "Failed to check out $git_obj_type $ref"
fi
unset ref git_obj_type
}
zinit_current_version() {
zinit_git_exec describe --tags 2> /dev/null
}
zinit_update() {
cd "${ZINIT_INSTALL_DIR}" || {
echo_error "Failed to cd to ${ZINIT_INSTALL_DIR}"
exit 1
}
echo_info "Updating ${COLOR_BOLD_CYAN}zinit${COLOR_RESET} in" \
"in ${COLOR_BOLD_MAGENTA}${ZINIT_INSTALL_DIR}"
{ # Clean up repo
zinit_git_exec clean -d -f -f
zinit_git_exec reset --hard HEAD
} > /dev/null 2>&1
# fetch our branch (to ensure the target commit exists locally)
zinit_git_exec fetch origin "$ZINIT_BRANCH"
zinit_checkout_ref
if zinit_git_exec pull origin "$ZINIT_BRANCH"; then
echo_success "Updated zinit to $(zinit_current_version)"
fi
}
zinit_install() {
cd "${ZINIT_HOME}" || {
echo_error "Failed to cd to ${ZINIT_HOME}"
exit 1
}
echo_info "Installing ${COLOR_BOLD_CYAN}zinit${COLOR_RESET} to " \
"${COLOR_BOLD_MAGENTA}${ZINIT_INSTALL_DIR}"
{
command git clone --progress --branch "$ZINIT_BRANCH" \
"https://github.com/${ZINIT_REPO}" \
"${ZINIT_REPO_DIR_NAME}" 2>&1 | {
"${ZINIT_TMPDIR}/git-process-output.zsh" || cat
}
} 2> /dev/null
zinit_checkout_ref
if [ -d "${ZINIT_REPO_DIR_NAME}" ]; then
echo_success "Zinit succesfully installed to " \
"${COLOR_BOLD_GREEN}${ZINIT_INSTALL_DIR}"
echo_info "Zinit Version: ${COLOR_BOLD_GREEN}$(zinit_current_version)"
else
echo_error "Failed to install Zinit to ${COLOR_BOLD_YELLOW}${ZINIT_INSTALL_DIR}"
fi
}
# Modify .zshrc
edit_zshrc() {
rc_update=1
if grep -E '(zinit|zplugin)\.zsh' "${ZSHRC}" > /dev/null 2>&1; then
echo_warning "${ZSHRC} already contains zinit commands. Not making any changes."
rc_update=0
fi
if [ $rc_update -eq 1 ]; then
echo_info "Updating ${ZSHRC} (10 lines of code, at the bottom)"
zinit_home_escaped=${ZINIT_HOME//$HOME/\$HOME}
command cat <<- EOF >> "$ZSHRC"
### Added by Zinit's installer
if [[ ! -f ${zinit_home_escaped}/${ZINIT_REPO_DIR_NAME}/zinit.zsh ]]; then
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}${ZINIT_REPO}%F{220})…%f"
command mkdir -p "${zinit_home_escaped}" && command chmod g-rwX "${zinit_home_escaped}"
command git clone https://github.com/${ZINIT_REPO} "${zinit_home_escaped}/${ZINIT_REPO_DIR_NAME}" && \\
print -P "%F{33} %F{34}Installation successful.%f%b" || \\
print -P "%F{160} The clone has failed.%f%b"
fi
source "${zinit_home_escaped}/${ZINIT_REPO_DIR_NAME}/zinit.zsh"
autoload -Uz _zinit
(( \${+_comps} )) && _comps[zinit]=_zinit
EOF
fi
unset rc_update zinit_home_escaped
}
query_for_annexes() {
zshrc_annex_file="$(mktemp)"
command cat <<- EOF >> "$zshrc_annex_file"
# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \\
zdharma-continuum/zinit-annex-as-monitor \\
zdharma-continuum/zinit-annex-bin-gem-node \\
zdharma-continuum/zinit-annex-patch-dl \\
zdharma-continuum/zinit-annex-rust
EOF
# Ask user if we should add the annexes to their zshrc
# If NO_INPUT is set, but NO_ANNEXES is the annexes bit gets appended to the
# config (ie. default to yes if NO_INPUT, unless NO_ANNEXES)
reply=n
if [ -n "$NO_INPUT" ]; then
[ -z "$NO_ANNEXES" ] && reply=y
else
echo "${COLOR_PALE_MAGENTA}${COLOR_RESET} Would you like to add 4 useful plugins" \
"- the most useful annexes (Zinit extensions that add new" \
"functions-features to the plugin manager) to the zshrc as well?" \
"It will be the following snippet:"
command cat "$zshrc_annex_file"
# shellcheck disable=2059
printf "${COLOR_PALE_MAGENTA}${COLOR_RESET} Enter y/n and press Return: "
read -r reply
fi
if [ "$reply" = y ] || [ "$reply" = Y ]; then
command cat "$zshrc_annex_file" >> "$ZSHRC"
echo_info "Installing annexes"
zsh -ic "@zinit-scheduler burst"
echo_success 'Done!'
else
echo_warning "Skipped the annexes."
fi
command cat <<- EOF >> "$ZSHRC"
### End of Zinit's installer chunk
EOF
unset reply zshrc_annex_file
}
display_tutorial() {
command cat <<- EOF
🌻 ${COLOR_BOLD_WHITE_ON_BLACK}Welcome!${COLOR_RESET}
Now to get started you can check out the following:
- The ${COLOR_BOLD_WHITE_ON_BLACK}README${COLOR_RESET} section on the ice-modifiers:
🧊 https://github.com/${ZINIT_REPO}#ice-modifiers
- There's also an ${COLOR_BOLD_WHITE_ON_BLACK}introduction${COLOR_RESET} to Zinit on the wiki:
📚 https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/
- The ${COLOR_BOLD_WHITE_ON_BLACK}For-Syntax${COLOR_RESET} article on the wiki, which highlights some best practices:
📖 https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/
💁 Need help?
- 💬 Get in touch with us on Gitter: https://gitter.im/zdharma-continuum
- 🔖 Or on GitHub: https://github.com/zdharma-continuum
EOF
}
# Globals. Can be overridden.
ZINIT_REPO="${ZINIT_REPO:-zdharma-continuum/zinit}"
ZINIT_BRANCH="${ZINIT_BRANCH:-main}"
ZINIT_COMMIT="${ZINIT_COMMIT:-}" # no default value
ZINIT_HOME="${ZINIT_HOME:-${XDG_DATA_HOME:-${HOME}/.local/share}/zinit}"
ZINIT_REPO_DIR_NAME="${ZINIT_REPO_DIR_NAME:-zinit.git}"
ZINIT_INSTALL_DIR=${ZINIT_INSTALL_DIR:-${ZINIT_HOME}/${ZINIT_REPO_DIR_NAME}}
ZSHRC="${ZSHRC:-${ZDOTDIR:-${HOME}}/.zshrc}"
show_environment
check_dependencies
create_zinit_home
create_zinit_tmpdir
download_git_output_processor
if [ -d "${ZINIT_INSTALL_DIR}/.git" ]; then
zinit_update
ZINIT_UPDATE=1
else
zinit_install
fi
if [ -z "$NO_EDIT" ]; then
edit_zshrc
[ -z "$ZINIT_UPDATE" ] && query_for_annexes
fi
if [ -z "$NO_TUTORIAL" ]; then
display_tutorial
fi
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=bash sw=2 ts=2 et

78
share/deploy_doc.sh Executable file
View file

@ -0,0 +1,78 @@
#!/bin/bash
# Non-zero exit code if anything fails
set -e
SOURCE_BRANCH="master"
TARGET_BRANCH="gh-pages"
# No pull requests and commits to other branches
if [[ "$TRAVIS_PULL_REQUEST" != "false" || "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]]; then
echo "Skipping deploy (pull request or different branch)"
exit 0
fi
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
SHA=`git rev-parse --verify HEAD`
# Create an empty branch if gh-pages doesn't exist
git clone "$REPO" out
git -C out checkout "$TARGET_BRANCH" || git -C out checkout --orphan "$TARGET_BRANCH"
# To count original files
LIST_ORIGINAL=( out/* )
# Remove existing contents
mv -v out/.git .git_out
mv -v out/index.html .
rm -rf out
mkdir out
mv .git_out out/.git
mv index.html out
touch out/.nojekyll
# Copy the PDFs (built earlier by .travis.yml / make)
cp -v zsdoc/pdf/*.pdf out
# To count new files
LIST_NEW=( out/* )
### CD ###
cd out
# No changes?
if git diff --quiet --exit-code && [[ "${#LIST_ORIGINAL}" -eq "${#LIST_NEW}" ]]; then
echo -- "<- ${LIST_ORIGINAL[@]}"
echo -- "-> ${LIST_NEW[@]}"
echo "NO CHANGES, exiting"
exit 0
fi
# Now let's go have some fun with the cloned repo
git config user.name "Sebastian Gniazdowski [Travis CI]"
git config user.email "$COMMIT_AUTHOR_EMAIL"
# Commit the new files
git add -A .
git commit -m "GitHub Pages deploy: ${SHA}"
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY="${!ENCRYPTED_KEY_VAR}"
ENCRYPTED_IV="${!ENCRYPTED_IV_VAR}"
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../share/deploy_key.enc -out ../share/deploy_key -d
chmod 600 ../share/deploy_key
eval `ssh-agent -s`
ssh-add ../share/deploy_key
echo
ls -1
echo
# Push to GitHub, without --force, it shouldn't be needed
git push "$SSH_REPO" "$TARGET_BRANCH"
rm -f ../share/deploy_key

BIN
share/deploy_key.enc Normal file

Binary file not shown.

View file

@ -1,186 +0,0 @@
#!/usr/bin/env zsh
#
# Copyright (c) 2016-2020 Sebastian Gniazdowski and contributors
# Copyright (c) 2021-2022 zdharma-continuum and contributors
emulate -LR zsh
setopt typesetsilent extendedglob warncreateglobal
{ typeset -g COLS="$(tput cols)" } 2>/dev/null
if (( COLS < 10 )); then
COLS=40
fi
# Credit to molovo/revolver for the ideas
progress_frames='0.1 ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏'
integer -g cur_frame=1
typeset -F SECONDS=0 last_time=0
# Alpine Linux doesn't have tput; FreeBSD and Dragonfly BSD have termcap
if whence tput &> /dev/null; then
if [[ $OSTYPE == freebsd* ]] || [[ $OSTYPE == dragonfly* ]]; then
# termcap commands
ZINIT_CNORM='tput ve'
ZINIT_CIVIS='tput vi'
else
# terminfo is more common
ZINIT_CNORM='tput cnorm'
ZINIT_CIVIS='tput civis'
fi
fi
if (( $+ZINIT_CNORM )); then
trap $ZINIT_CNORM EXIT INT TERM
fi
local first=1
# Code by leoj3n
timeline() {
local sp='▚▞'; sp="${sp:$2%2:1}"
# Maximal width is 24 characters
local bar="$(print -f "%.$2s█%0$(($3-$2-1))s" "████████████████████████" "")"
local -a frames_splitted
frames_splitted=( ${(@zQ)progress_frames} )
if (( SECONDS - last_time >= frames_splitted[1] )); then
(( cur_frame = (cur_frame+1) % (${#frames_splitted}+1-1) ))
(( cur_frame = cur_frame ? cur_frame : 1 ))
last_time=$SECONDS
fi
print -nr -- ${frames_splitted[cur_frame+1]}" "
print -nPr "%F{183}"
print -f "%s %s" "${bar// /░}" ""
print -nPr "%f"
}
# $1 - n. of objects
# $2 - packed objects
# $3 - total objects
# $4 - receiving percentage
# $5 - resolving percentage
print_my_line() {
local col="%F{155}" col3="%F{155}" col4="%F{155}" col5="%F{155}"
[[ -n "${4#...}" && -z "${5#...}" ]] && col3="%F{81}"
[[ -n "${5#...}" ]] && col4="%F{81}"
if (( COLS >= 70 )); then
print -Pnr -- "${col}OBJ%f: $1, ${col}PACK%f: $2/$3${${4:#...}:+, ${col3}REC%f: $4%}${${5:#...}:+, ${col4}RES%f: $5%} "
elif (( COLS >= 60 )); then
print -Pnr -- "${col}OBJ%f: $1, ${${4:#...}:+, ${col3}REC%f: $4%}${${5:#...}:+, ${col4}RES%f: $5%} "
else
print -Pnr -- "${${4:#...}:+, ${col3}REC%f: $4%}${${5:#...}:+, ${col4}RES%f: $5%} "
fi
print -n $'\015'
}
print_my_line_compress() {
local col="%F{155}" col3="%F{155}" col4="%F{155}" col5="%F{155}"
[[ -n "${4#...}" && -z "${5#...}" && -z "${6#...}" ]] && col3="%F{81}"
[[ -n "${5#...}" && -z "${6#...}" ]] && col4="%F{81}"
[[ -n "${6#...}" ]] && col5="%F{81}"
if (( COLS >= 80 )); then
print -Pnr -- "${col}OBJ%f: $1, ${col}PACK%f: $2/$3, ${col3}COMPR%f: $4%%${${5:#...}:+, ${col4}REC%f: $5%%}${${6:#...}:+, ${col5}RES%f: $6%%} "
elif (( COLS >= 65 )); then
print -Pnr -- "${col}OBJ%f: $1, ${col3}COMPR%f: $4%%${${5:#...}:+, ${col4}REC%f: $5%%}${${6:#...}:+, ${col5}RES%f: $6%%} "
else
print -Pnr -- "${col}OBJ%f: $1, ${${5:#...}:+, ${col4}REC%f: $5%%}${${6:#...}:+, ${col5}RES%f: $6%%} "
fi
print -n $'\015'
}
integer have_1_counting=0 have_2_total=0 have_3_receiving=0 have_4_deltas=0 have_5_compress=0
integer counting_1=0 total_2=0 total_packed_2=0 receiving_3=0 deltas_4=0 compress_5=0
integer loop_count=0
IFS=''
[[ $+ZINIT_CIVIS == 1 && -n $TERM ]] && eval $ZINIT_CIVIS
if [[ -n $TERM ]]; then
{ command perl -pe 'BEGIN { $|++; $/ = \1 }; tr/\r/\n/' || gstdbuf -o0 gtr '\r' '\n' || cat } |& while read -r line; do
(( ++ loop_count ))
if [[ "$line" = "Cloning into"* ]]; then
print $line
continue
elif [[ "$line" = (#i)*user*name* || "$line" = (#i)*password* ]]; then
print $line
continue
elif [[ "$line" = remote:*~*(Counting|Total|Compressing|Enumerating)* || "$line" = fatal:* ]]; then
print $line
continue
fi
if [[ "$line" = (#b)"remote: Counting objects:"[\ ]#([0-9]##)(*) ]]; then
have_1_counting=1
counting_1="${match[1]}"
fi
if [[ "$line" = (#b)"remote: Enumerating objects:"[\ ]#([0-9]##)(*) ]]; then
have_1_counting=1
counting_1="${match[1]}"
fi
if [[ "$line" = (#b)*"remote: Total"[\ ]#([0-9]##)*"pack-reused"[\ ]#([0-9]##)* ]]; then
have_2_total=1
total_2="${match[1]}" total_packed_2="${match[2]}"
fi
if [[ "$line" = (#b)"Receiving objects:"[\ ]#([0-9]##)%([[:blank:]]#\(([0-9]##)/([0-9]##)\)|)* ]]; then
have_3_receiving=1
receiving_3="${match[1]}"
if [[ -n "${match[2]}" ]]; then
have_2_total=1
total_packed_2="${match[3]}" total_2="${match[4]}"
fi
fi
if [[ "$line" = (#b)"Resolving deltas:"[\ ]#([0-9]##)%* ]]; then
have_4_deltas=1
deltas_4="${match[1]}"
fi
if [[ "$line" = (#b)"remote: Compressing objects:"[\ ]#([0-9]##)"%"(*) ]]; then
have_5_compress=1
compress_5="${match[1]}"
fi
if (( loop_count >= 2 )); then
integer pr
(( pr = have_4_deltas ? deltas_4 / 10 : ( have_3_receiving ? receiving_3 / 10 : ( have_5_compress ? compress_5 / 10 : ((( loop_count - 1 )/14 ) % 10) + 1 )) ))
timeline "" $pr 11
if (( have_5_compress )); then
print_my_line_compress "${${${(M)have_1_counting:#1}:+$counting_1}:-...}" \
"${${${(M)have_2_total:#1}:+$total_packed_2}:-0}" \
"${${${(M)have_2_total:#1}:+$total_2}:-0}" \
"${${${(M)have_5_compress:#1}:+$compress_5}:-...}" \
"${${${(M)have_3_receiving:#1}:+$receiving_3}:-...}" \
"${${${(M)have_4_deltas:#1}:+$deltas_4}:-...}"
else
print_my_line "${${${(M)have_1_counting:#1}:+$counting_1}:-...}" \
"${${${(M)have_2_total:#1}:+$total_packed_2}:-0}" \
"${${${(M)have_2_total:#1}:+$total_2}:-0}" \
"${${${(M)have_3_receiving:#1}:+$receiving_3}:-...}" \
"${${${(M)have_4_deltas:#1}:+$deltas_4}:-...}"
fi
fi
done
else
grep fatal:
fi
print
[[ $+ZINIT_CNORM == 1 && -n $TERM ]] && eval $ZINIT_CNORM
unset ZINIT_CNORM ZINIT_CIVIS
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View file

@ -1,64 +0,0 @@
#!/usr/bin/env zsh
#
# -*- mode: sh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
#
# Copyright (c) 2016-2020 Sebastian Gniazdowski and contributors
# Copyright (c) 2021-2022 zdharma-continuum and contributors
emulate -R zsh -o extendedglob
local pkg=$1
if [[ -z $pkg || ! -e $pkg ]]; then
print -u2 -Pr "%F{160}rpm2cpio.sh%f: no package supplied"
exit 1
fi
local leadsize=96
local o=$(( $leadsize + 8 ))
set -- ${(s: :)$(od -j $o -N 8 -t u1 $pkg)}
local i=$(( 256 * ( 256 * ( 256 * $2 + $3 ) + $4 ) + $5 ))
local d=$(( 256 * ( 256 * ( 256 * $6 + $7 ) + $8 ) + $9 ))
sigsize=$(( 8 + 16 * $i + $d ))
o=$(( $o + $sigsize + ( 8 - ( $sigsize % 8 ) ) % 8 + 8 ))
set -- ${(s: :)$(od -j $o -N 8 -t u1 $pkg)}
i=$(( 256 * ( 256 * ( 256 * $2 + $3 ) + $4 ) + $5 ))
d=$(( 256 * ( 256 * ( 256 * $6 + $7 ) + $8 ) + $9 ))
local hdrsize=$(( 8 + 16 * $i + $d ))
o=$(( $o + $hdrsize ))
local -a UNPACKCMD
UNPACKCMD=( dd if=$pkg ibs=$o skip=1 )
local COMPRESSION="$($=UNPACKCMD | file -)"
local -a DECOMPRESSCMD
if [[ $COMPRESSION == (#i)*gzip* ]]; then
DECOMPRESSCMD=( gunzip )
elif [[ $COMPRESSION == (#i)*bzip2* ]]; then
DECOMPRESSCMD=( bunzip2 )
elif [[ $COMPRESSION == (#i)*xz* ]]; then
DECOMPRESSCMD=( unxz )
elif [[ $COMPRESSION == (#i)*cpio* ]]; then
DECOMPRESSCMD=( cat )
else
DECOMPRESSCMD=( $(which unlzma 2>/dev/null) )
if [[ $DECOMPRESSCMD != /* ]]; then
DECOMPRESSCMD=( $(which lzmash 2>/dev/null) )
if [[ $DECOMPRESSCMD == /* ]]; then
DECOMPRESSCMD=( lzmash -d -c )
else
DECOMPRESSCMD=( cat )
fi
fi
fi
command "$UNPACKCMD[@]" 2>/dev/null | command "$DECOMPRESSCMD[@]"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View file

@ -1,45 +0,0 @@
#!/usr/bin/env zsh
#
# Copyright (c) YEAR USER_NAME
# An example of type-agnostic script/function, i.e.: the file can be run as a +x
# script or as an autoload function.
# Set the base and typically useful options
emulate -LR zsh
setopt extendedglob warncreateglobal typesetsilent noshortloops rcquotes noautopushd
# Run as script? ZSH_SCRIPT is a Zsh 5.3 addition
if [[ $0 != template-script || -n $ZSH_SCRIPT ]]; then
# Handle $0 according to the Zsh Plugin Standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0=${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}
0=${${(M)0##/*}:-$PWD/$0}
# Such global variable is expected to be typeset'd -g in the plugin.zsh
# file. Here it's restored in case of the function being run as a script.
typeset -gA Plugins
Plugins[MY_PLUGIN_DIR]=${0:h}
# In case of the script using other scripts from the plugin, either set up
# $fpath and autoload, or add the directory to $PATH.
fpath+=( $Plugins[MY_PLUGIN_DIR] )
autoload …
# OR
path+=( $Plugins[MY_PLUGIN_DIR] )
fi
# The script/function contents possibly using $Plugins[MY_PLUGIN_DIR] …
# …
# Use alternate marks [[[ and ]]] as the original ones can confuse nested
# substitutions, e.g.: ${${${VAR}}}
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et foldmarker=[[[,]]] foldmethod=marker

View file

@ -1,28 +0,0 @@
# Zsh compiled script + zrecompile backup
*.zwc
*.zwc.old
# Zsh completion-optimization dumpfile
*zcompdump*
# Zsh zcalc history
.zcalc_history
# A popular plugin manager's files
._zinit
.zinit_lastupd
# zdharma/zshelldoc tool's files
zsdoc/data
# ohmyzsh/ohmyzsh/plugins/per-directory-history plugin's files
# (when set-up to store the history in the local directory)
.directory_history
# MichaelAquilina/zsh-autoswitch-virtualenv plugin's files
# (for Zsh plugins using Python)
.venv
# Zunit tests' output
/tests/_output/*
!/tests/_output/.gitkeep

View file

@ -1,47 +0,0 @@
#
# Language: Zsh
#
--langdef=zsh
--langmap=zsh:.zsh
#
# 1. Detect variables
# 2. … and function names.
#
--kinddef-zsh=v,var,variables
--kinddef-zsh=f,fun,functions
--_tabledef-zsh=main
--_tabledef-zsh=vardef
--_tabledef-zsh=comment
--_tabledef-zsh=equal
# Feature: Zsh variable detection
--_mtable-regex-zsh=main/^\s*(local|typeset|declare|integer|float|readonly)\s+(-\w+\s+)*///{tenter=vardef}
# Feature: Zsh function name detection
--_mtable-regex-zsh=main/^\s*(function\s+|)([[:alnum:]:@∞.+-]+)\(\s*\)\s*([\{]|[\n]+[\{])/\2/f/
--_mtable-regex-zsh=main/^\s*[\#][^\n]*///{tenter=comment}
--_mtable-regex-zsh=main/.//
--_mtable-regex-zsh=comment/[\n]///{tleave}
--_mtable-regex-zsh=comment/.//
--_mtable-regex-zsh=equal/([\"][^\"]*[\"])///{exclusive}{tleave}
--_mtable-regex-zsh=equal/([\'][^\']*[\'])///{exclusive}{tleave}
--_mtable-regex-zsh=equal/([\$][\(][\(])([^\)][^\)])*([^\)]){0,1}([\)][\)])///{exclusive}{tleave}
--_mtable-regex-zsh=equal/([\$][\(])([^\)]*)([\)])///{exclusive}{tleave}
--_mtable-regex-zsh=equal/([\(])([^\)]*)([\)])///{exclusive}{tleave}
# Try to match sequences of ${…}\w${…}…
--_mtable-regex-zsh=equal/([\$][\{])((([^\}]*[\}][^\s][\$][\{])*[^\}]*)|[^\}]*)([\}])///{exclusive}{tleave}
--_mtable-regex-zsh=equal/[^\s\n]+///{exclusive}{tleave}{_advanceTo=0start} 
--_mtable-regex-zsh=equal/[\n\s]///{exclusive}{tleave}{_advanceTo=0start}
# Match with required ="…
--_mtable-regex-zsh=vardef/([a-zA-Z_]\w*)([\=])/\1/v/{exclusive}{tenter=equal}
--_mtable-regex-zsh=vardef/([a-zA-Z_]\w*)/\1/v/{exclusive}
--_mtable-regex-zsh=vardef/[\x5C][\n]///{exclusive}
--_mtable-regex-zsh=vardef/([\n;\}\)\|\&])///{tleave}{exclusive}
--_mtable-regex-zsh=vardef/^\s*[\#][^\n]*///{tenter=comment}{exclusive}
--_mtable-regex-zsh=vardef/.//

View file

View file

@ -1,15 +0,0 @@
#!/usr/bin/env zsh
is_annex() {
local annex="zinit-annex-${1}"
run zinit load zdharma-continuum/${annex}
assert ${state} equals 0
zinit cd zdharma-continuum/${annex}
assert ${PWD}/${${annex}//zinit-annex/z-a}.plugin.zsh is_file
assert ${PWD}/${${annex}//zinit-annex/z-a}.plugin.zsh is_readable
}
load_bin_gem_node(){
run zinit load @zdharma-continuum/zinit-annex-bin-gem-node
zinit default-ice from'gh-r'
}

View file

@ -1,94 +0,0 @@
#!/usr/bin/env zsh
# emulate -L zsh
# setopt no_global_rcs no_rcs no_aliases extended_glob null_glob
emulate zsh
setopt no_global_rcs no_rcs no_aliases extended_glob
# Every git clone below -- this repo, the annexes, and each plugin a test
# installs -- must keep unix EOLs. A developer or CI runner with
# core.autocrlf=true otherwise gets CRLF sources that zsh cannot parse, which
# surfaces as unrelated-looking failures (`command not found: ^M', exit 126)
# across the whole suite. Exported so it reaches the git invocations zinit
# makes from inside the tests, not just the ones here.
# core.eol has to be pinned as well: with the text attribute set, autocrlf=false
# hands the decision to core.eol, so a global core.eol=crlf still produces CRLF.
export GIT_CONFIG_COUNT=2 \
GIT_CONFIG_KEY_0=core.autocrlf GIT_CONFIG_VALUE_0=false \
GIT_CONFIG_KEY_1=core.eol GIT_CONFIG_VALUE_1=lf
# Log functions [[[
function error(){ print -P "%F{red}[ERROR]%f: ${1}" && return 1; }
function info() { print -P "%F{green}[INFO]%f:%F{cyan} ${1} %f"; }
function warn() { print -P "%F{yellow}[WARN]%f: ${1}"; }
# ]]]
# Create Zunit test environment [[[
GIT_REPO=$(git rev-parse --show-toplevel)
_mktemp_cmd='mktemp'
if (( ${+commands[gmktemp]} )); then
_mktemp_cmd='gmktemp'
fi
TMP_ZUNIT=$(${_mktemp_cmd} --directory --tmpdir="${GIT_REPO}/tests/_support")
if [[ ! -d ${TMP_ZUNIT} ]]; then
error "zunit temp dir not found"
exit 1
fi
typeset -gx zi_test_dir="${TMP_ZUNIT}"
typeset -gxAUH ZINIT=()
ZINIT+=(
BIN_DIR "${zi_test_dir}/zinit.git"
COMPLETIONS_DIR "${zi_test_dir}/completions" SNIPPETS_DIR "${zi_test_dir}/snippets"
HOME_DIR "${zi_test_dir}" PLUGINS_DIR "${zi_test_dir}/plugins"
ZCOMPDUMP_PATH "${zi_test_dir}/zcompdump" ZPFX "${zi_test_dir}/polaris"
POLARIS "${zi_test_dir}/polaris"
)
typeset -gxH ZPFX=
ZPFX="${zi_test_dir}/polaris"
command git diff > ${ZINIT[HOME_DIR]}/unstaged.diff
# info 'creating test env'
git clone \
--quiet \
--depth=1 \
--dissociate \
--no-hardlinks \
--reference "${GIT_REPO}" \
file://${GIT_REPO:A} \
"${ZINIT[BIN_DIR]}" >/dev/null
if (( $? != 0 )); then
error "Unable to copy ${GIT_REPO} to ${TMP_ZUNIT}" >&2
exit 1
fi
if [[ -s $ZINIT[HOME_DIR]/unstaged.diff ]]; then
(
git -C "${ZINIT[BIN_DIR]}" apply "${ZINIT[HOME_DIR]}/unstaged.diff" && \
chmod g-rwX "${ZINIT[HOME_DIR]}" && \
zcompile "${ZINIT[BIN_DIR]}/zinit.zsh" >/dev/null
) >/dev/null
fi
(( $? != 0 )) && { error "Unable to copy ${GIT_REPO} to ${TMP_ZUNIT}" >&2; exit 1 }
hash -f
builtin hash -d zinit="${zi_test_dir}"
builtin hash -d zpfx="${zi_test_dir}/polaris"
builtin hash -d plugins="${zi_test_dir}/plugins"
source "${zi_test_dir}/zinit.git/zinit.zsh"
(( $? != 0 )) && { error "Unable to source zinit" >&2; exit 1 }
hash -f
builtin hash -d zinit="${zi_test_dir}"
builtin hash -d zpfx="${zi_test_dir}/polaris"
builtin hash -d plugins="${zi_test_dir}/plugins"
{
zinit for \
@zdharma-continuum/zinit-annex-bin-gem-node \
@zdharma-continuum/zinit-annex-binary-symlink \
@zdharma-continuum/zinit-annex-default-ice \
@zdharma-continuum/zinit-annex-linkman
}>/dev/null
zinit zstatus

View file

@ -1,50 +0,0 @@
#!/usr/bin/env zsh
#
# Easily generate gh-r Zunit tests.
#
# Usage:
# gen-ghr-test [<user/repository>...]
#
# Note: Tests might require slight adjustments to the lbin or id-as ice
#
(){
local flag_help
local -a usage=(
"gen-ghr-test [-h|--help]"
"gen-ghr-test [<project...>]"
)
# -D pulls parsed flags out of $@
# -E allows flags/args and positionals to be mixed, which we don't want in this example
# -F says fail if we find a flag that wasn't defined
# -M allows us to map option aliases (ie: h=flag_help -help=h)
# -K allows us to set default values without zparseopts overwriting them
# Remember that the first dash is automatically handled, so long options are -opt, not --opt
zmodload zsh/zutil
zparseopts -D -F -K -- \
{h,-help}=flag_help \
|| return 1
[[ -z "$flag_help" ]] || { print -l $usage; return 0 }
(( !$# )) && {
builtin print -P -- "%F{red}Error%f gen-ghr-test requires one or more arguments"
return 1
}
local repo description bin_name
for repo in $@; do
bin_name="${repo:t}"
description="$(gh search repos "${repo}" --limit 1 --json description -q '.[].[]')"
cat <<- EOF
@test '${bin_name}' { # ${description}
run zinit for @${repo}; assert \$state equals 0
local $bin_name="\$ZBIN/${bin_name}"; assert "\$${bin_name}" is_executable
run "\$${bin_name}" --version; assert \$state equals 0
}
EOF
done
} $@
# vim: set expandtab filetype=zsh shiftwidth=2 softtabstop=2 tabstop=2:

View file

@ -1,66 +0,0 @@
#!/usr/bin/env zsh
# Fixtures for the `zinit self-update` pager regression tests (issue #632).
#
# make_self_update_behind_upstream leaves the sandbox clone exactly one
# commit behind a scratch bare upstream. The fixture commit reuses HEAD's
# tree, so the fast-forward pull done by `zinit self-update` moves only the
# branch pointer: the unstaged diff the bootstrap applies stays intact and
# no working-tree restore is needed, even when an assertion aborts the
# test. Everything is offline and also works when the bootstrap clone is a
# detached HEAD (CI pull_request checkouts), because the `main` branch and
# its upstream are created here.
typeset -g SU_FIXTURE_SUBJECT='chore: self-update pager regression fixture'
make_self_update_behind_upstream() {
local bin="${ZINIT[BIN_DIR]}" up="${ZINIT[HOME_DIR]}/self-update-upstream.git"
local fixture_sha
# The bootstrap clone is depth=1. Complete it (origin is the local repo,
# so this is offline) to lift the shallow-repo restrictions from the
# local-path push below. From the second call on, the repo is already
# complete and this fails harmlessly.
command git -C "$bin" fetch --quiet --unshallow 2>/dev/null || true
# The sandbox tree is dirty (the bootstrap applies the unstaged diff), so
# ambient pull.rebase/autostash settings change what `git pull` does and
# prints: rebase mode refuses the dirty tree, autostash prints notices
# even under --quiet. Pin all three off in the clone so the pull is a
# silent fast-forward everywhere. --local keeps the writes inside the
# sandbox even where GIT_CONFIG points elsewhere.
command git -C "$bin" config --local pull.rebase false 2>/dev/null || true
command git -C "$bin" config --local merge.autostash false 2>/dev/null || true
command git -C "$bin" config --local rebase.autoStash false 2>/dev/null || true
fixture_sha=$(command git -C "$bin" -c user.name=zunit -c user.email=zunit@localhost \
commit-tree 'HEAD^{tree}' -p HEAD -m "$SU_FIXTURE_SUBJECT") || true
[[ -n $fixture_sha ]] || fail 'fixture: commit-tree failed'
command rm -rf -- "$up"
command git -c init.defaultBranch=main init --quiet --bare "$up" 2>/dev/null \
|| fail 'fixture: git init failed'
command git -C "$bin" push --quiet "$up" "${fixture_sha}:refs/heads/main" \
|| fail 'fixture: git push failed'
# remove+add also replaces the narrowed single-branch fetch refspec of
# the depth=1 bootstrap clone with the wildcard one that the `git pull`
# inside self-update relies on.
command git -C "$bin" remote remove origin 2>/dev/null || true
command git -C "$bin" remote add origin "$up" || fail 'fixture: remote add failed'
command git -C "$bin" fetch --quiet origin || fail 'fixture: fetch failed'
# Covers detached-HEAD sandboxes and avoids the non-main-branch warning
# that self-update prints even under --quiet.
command git -C "$bin" checkout --quiet -B main || fail 'fixture: checkout failed'
command git -C "$bin" branch --quiet --set-upstream-to=origin/main main \
|| fail 'fixture: set-upstream failed'
}
restore_self_update_origin() {
local bin="${ZINIT[BIN_DIR]}"
[[ -n $GIT_REPO ]] || return 0
command git -C "$bin" remote remove origin 2>/dev/null || true
command git -C "$bin" remote add origin "file://${GIT_REPO:A}" 2>/dev/null || true
command rm -rf -- "${ZINIT[HOME_DIR]}/self-update-upstream.git"
}

View file

@ -1,41 +0,0 @@
#!/usr/bin/env zunit
@setup {
load "${PWD}/tests/_support/annex_test_assertions"
}
@test 'zinit-annex-bin-gem-node' {
is_annex "bin-gem-node"
}
@test 'zinit-annex-binary-symlink' {
is_annex "binary-symlink"
}
@test 'zinit-annex-man' {
is_annex "man"
}
@test 'zinit-annex-meta-plugins' {
is_annex "meta-plugins"
}
@test 'zinit-annex-patch-dl' {
is_annex "patch-dl"
}
@test 'zinit-annex-pull' {
is_annex 'pull'
}
@test 'zinit-annex-readurl' {
is_annex 'readurl'
}
@test 'zinit-annex-rust' {
is_annex 'rust'
}
@test 'zinit-annex-submods' {
is_annex 'submods'
}
@test 'zinit-annex-test' {
is_annex 'test'
}
@test 'zinit-annex-unscope' {
is_annex 'unscope'
}
# vim:ft=zsh:sw=2:sts=2:et:foldmarker={,}:foldmethod=marker

View file

@ -1,142 +0,0 @@
#!/usr/bin/env zunit
# vim:ft=zsh:sw=4:sts=4:et:foldmarker={,}:foldmethod=marker
#
# zdharma-continuum/zinit/tests/commands.zunit
# Copyright (c) 2016-2021 Sebastian Gniazdowski
# Copyright (c) 2021-2024 zdharma-continuum
# Homepage: https://github.com/zdharma-continuum/zinit
# License: MIT License
#
@setup {
typeset -gx HOME="$zi_test_dir"
typeset -gx ZBIN="$zi_test_dir/polaris/bin"
load "${PWD}/tests/_support/self_update_fixtures"
}
@test 'help' {
for cmd in 'help' '-h' '--help'; do
run zinit $cmd
assert $output contains '—— help usage information'
assert $state equals 0
done
run zinit -help
assert $output contains 'Unknown subcommand'
assert $state equals 1
}
@test 'delete --help' {
run zinit delete --help
assert $output contains 'zinit delete [options] [plugins...]'
assert $state equals 0
}
@test 'delete --all' {
run zinit as'completion' is-snippet for @'https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker'
assert $state equals 0
}
@test 'delete a snippet' {
run zinit id-as'git.zsh' is-snippet for @'OMZL::git.zsh'
run zinit delete --yes 'git.zsh'
assert $state equals 0
}
@test 'delete a plugin' {
run zinit from'gh-r' as'program' id-as mv'shfmt* -> shfmt' for @'mvdan/sh'
run zinit delete --yes sh
assert $state equals 0
}
@test 'delete a program' {
run zinit as'program' cp'wd.sh->wd' mv'_wd.sh->_wd' pick'wd' completions for @'mfaerevaag/wd'
assert $state equals 0
run return ${+commands[wd]}; assert $state equals 0
run zinit delete --yes mfaerevaag/wd
}
@test 'plugins' {
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit plugins)
assert $state equals 0
assert $output contains "==> 5 Plugins"
assert $output contains 'Loaded: L | Unloaded: U'
}
@test 'plugins with keyword' {
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit plugins zdharma)
assert $state equals 0
assert $output contains "==> 4 Plugins matching 'zdharma'"
}
@test 'self-update' {
run zinit self-update
assert $output matches 'Already up to date'; assert $state equals 0
run zinit self-update --help
assert $output matches '.*(HELP).*(self-update).*'; assert $state equals 1
run zinit self-update --quiet
assert $output is_empty; assert $state equals 0
}
@test 'self-update --help / -h shows help and exits 1' {
for flag in '--help' '-h'; do
run zinit self-update $flag
assert $output contains 'self-update'
assert $output contains '--quiet'
assert $output contains '--no-pager'
assert $state equals 1
done
}
@test 'self-update --quiet / -q suppresses output' {
for flag in '--quiet' '-q'; do
run zinit self-update $flag
assert $output is_empty
assert $state equals 0
done
}
@test 'self-update rejects unknown flags' {
run zinit self-update --foo
assert $output contains 'Incorrect options given'
assert $output contains '--foo'
assert $state equals 1
}
@test 'self-update --no-pager / -n accepted when up to date' {
for flag in '--no-pager' '-n'; do
run zinit self-update $flag
assert $output contains 'Already up to date'
assert $state equals 0
done
}
@test 'self-update pages the commit list through less by default' {
less() { command cat > /dev/null; builtin print -- 'PAGER-INVOKED'; }
make_self_update_behind_upstream
run zinit self-update
assert $output contains 'PAGER-INVOKED'
assert $output does_not_contain $SU_FIXTURE_SUBJECT
assert $state equals 0
}
@test 'self-update --no-pager / -n prints the commit list without the pager' {
less() { command cat > /dev/null; builtin print -- 'PAGER-INVOKED'; }
for flag in '--no-pager' '-n'; do
make_self_update_behind_upstream
run zinit self-update $flag
assert $output contains $SU_FIXTURE_SUBJECT
assert $output does_not_contain 'PAGER-INVOKED'
assert $state equals 0
done
}
@test 'self-update --quiet / -q skips the pager when behind upstream' {
less() { command cat > /dev/null; builtin print -- 'PAGER-INVOKED'; }
for flag in '--quiet' '-q'; do
make_self_update_behind_upstream
run zinit self-update $flag
assert $output is_empty
assert $state equals 0
done
restore_self_update_origin
}
@test 'set-debug' {
ZINIT+=(DEBUG 'true')
run +zi-log -n '{dbg} message'
assert $output contains '[debug]'; assert $state equals 0
}
@test 'unset-dbg' {
run +zi-log -n '{dbg} message'; assert $output contains ''
run +zi-log -n '{m} message'
assert $output contains 'message'; assert $state equals 0
}

View file

@ -1,53 +0,0 @@
#!/usr/bin/env zunit
# vim:ft=zsh:sw=4:sts=4:et:foldmarker={,}:foldmethod=marker
@setup {
typeset -gx HOME="$zi_test_dir"
typeset -gx ZBIN="$zi_test_dir/polaris/bin"
}
@test 'compile ice - multiple files' {
run zinit for compile'h*~*zwc' id-as'hsmw-compile-ice' @zdharma-continuum/history-search-multi-word
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit compile hsmw-compile-ice)
assert $output contains "==> Compiling 4 files history-search-multi-word, history-search-multi-word.plugin.zsh, hsmw-context-main, hsmw-highlight [OK]"
assert $state equals 0
}
@test 'compile ice - single file' {
run zinit for id-as'hsmw-no-compile-ice' @zdharma-continuum/history-search-multi-word
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit compile hsmw-no-compile-ice)
assert $state equals 0
assert $output contains "==> Compiling history-search-multi-word.plugin.zsh [OK]"
}
@test 'compile ice' {
run zinit light @zdharma-continuum/history-search-multi-word
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit compile zdharma-continuum/history-search-multi-word)
assert $state equals 0
assert $output contains "==> Compiling history-search-multi-word.plugin.zsh [OK]"
}
@test 'compile cmd' {
run zinit for id-as"compile-command" @zdharma-continuum/history-search-multi-word
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit compile --quiet compile-command)
assert $state equals 0
assert $output contains "==> Compiling history-search-multi-word.plugin.zsh [OK]"
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit compiled)
assert $state equals 0
assert $output contains 'compile-command:'
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit uncompile --quiet compile-command)
assert $state equals 0; assert $output contains '==> Uncompiling compile-command [OK]'
}
@test 'compiled cmd' {
zinit uncompile --all --quiet
run zinit compiled; assert $state equals 0
assert $output contains 'No compiled plugins'
}
@test 'uncompile cmd' {
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit compile -q compile-command)
assert $state equals 0
run perl -pe 's/\x1b\[[0-9;]*[mG]//g' <(zinit uncompile -q compile-command)
assert $state equals 0
assert $output contains '==> Uncompiling compile-command [OK]'
}

View file

@ -1,68 +0,0 @@
#!/usr/bin/env zunit
# vim:ft=zsh:sw=4:sts=4:et:foldmarker={,}:foldmethod=marker
#
# zdharma-continuum/zinit/tests/config-zstyle.zunit
# Copyright (c) 2016-2021 Sebastian Gniazdowski
# Copyright (c) 2021-2024 zdharma-continuum
# Homepage: https://github.com/zdharma-continuum/zinit
# License: MIT License
#
# Tests for configuring ZINIT[...] settings via `zstyle ':zinit:config' ...'.
#
# NOTE: the test bootstrap pre-sets every ZINIT[KEY], which would mask the
# zstyle path. Each test therefore exercises the feature in a CLEAN
# `zsh -fc` subshell that sets a zstyle, sources the patched zinit.zsh
# (located at ${ZINIT[BIN_DIR]}/zinit.zsh inside the test env) and prints the
# resulting hash field.
#
# The subshell is captured with `$(...)` rather than zunit's `run`: `run`
# re-`eval`s its arguments in the *outer* process, where the bootstrap has
# already populated ZINIT[HOME_DIR] et al., which would clobber the inner
# `${ZINIT[...]}` reads we want to observe. Single-quoting the inner script
# defers those reads to the subshell; only ${ZINIT[BIN_DIR]} is expanded
# (concatenated in) by the outer shell to locate zinit.zsh.
#
@test 'zstyle fills an unset key' {
output=$(zsh -fc 'zmodload zsh/zutil; typeset -gAH ZINIT
ZINIT[BIN_DIR]='"${ZINIT[BIN_DIR]}"'
zstyle ":zinit:config" home-dir /tmp/zi-fromstyle
source '"${ZINIT[BIN_DIR]}"'/zinit.zsh >/dev/null 2>&1
print -r -- ${ZINIT[HOME_DIR]}')
state=$?
assert $state equals 0
assert $output same_as '/tmp/zi-fromstyle'
}
@test 'explicit ZINIT[KEY] beats zstyle' {
output=$(zsh -fc 'zmodload zsh/zutil; typeset -gAH ZINIT
ZINIT[BIN_DIR]='"${ZINIT[BIN_DIR]}"'
ZINIT[HOME_DIR]=/tmp/zi-explicit
zstyle ":zinit:config" home-dir /tmp/zi-fromstyle
source '"${ZINIT[BIN_DIR]}"'/zinit.zsh >/dev/null 2>&1
print -r -- ${ZINIT[HOME_DIR]}')
state=$?
assert $state equals 0
assert $output same_as '/tmp/zi-explicit'
}
@test 'derived dir follows zstyle-provided home-dir' {
output=$(zsh -fc 'zmodload zsh/zutil; typeset -gAH ZINIT
ZINIT[BIN_DIR]='"${ZINIT[BIN_DIR]}"'
zstyle ":zinit:config" home-dir /tmp/zi-fromstyle
source '"${ZINIT[BIN_DIR]}"'/zinit.zsh >/dev/null 2>&1
print -r -- ${ZINIT[PLUGINS_DIR]}')
state=$?
assert $state equals 0
assert $output same_as '/tmp/zi-fromstyle/plugins'
}
@test 'no zstyle, no array still resolves a default home-dir' {
output=$(zsh -fc 'zmodload zsh/zutil; typeset -gAH ZINIT
ZINIT[BIN_DIR]='"${ZINIT[BIN_DIR]}"'
source '"${ZINIT[BIN_DIR]}"'/zinit.zsh >/dev/null 2>&1
[[ -n ${ZINIT[HOME_DIR]} ]] && print OK')
state=$?
assert $state equals 0
assert $output same_as 'OK'
}

View file

@ -1,912 +0,0 @@
#!/usr/bin/env zunit
# vim:ft=zsh:sw=4:sts=4:et:foldmarker={,}:foldmethod=marker
@setup {
load "${PWD}/tests/_support/annex_test_assertions"
HOME="$zi_test_dir" # Stops programs creating directories in user home
typeset -gx ZBIN="$zi_test_dir/polaris/bin" os_type="${OSTYPE//[0-9\.]*/}"
[[ ! -d $ZBIN ]] && mkdir -p "$ZBIN"
arch=$(uname -m)
zinit default-ice --quiet from'gh-r' lbin'!' null
}
@test 'act' { # Run your GitHub Actions locally
run zinit for @nektos/act; assert $state equals 0
local act="$ZBIN/act"; assert "$act" is_executable
run "$act" --version; assert $state equals 0
}
@test 'akamai' { # Manage and configure Akamai from the Command Line.
run zinit id-as'akamai' lbin'!akamai*->akamai' for @akamai/cli; assert $state equals 0
local cli="$ZBIN/akamai"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
@test 'alacritty' { # Run your GitHub alacrittyions locally
[[ $OSTYPE =~ 'linux*' ]] && skip "Alacritty test skipped on $os_type"
run zinit for @alacritty/alacritty; assert $state equals 0
local alacritty="$ZBIN/alacritty"; assert "$alacritty" is_executable
run "$alacritty" --version; assert $state equals 0
}
@test 'alist' { # A file list program that supports multiple storage, powered by Gin and React
run zinit lbin'!* -> alist' for @alistgo/alist; assert $state equals 0
local alist="$ZBIN/alist"; assert "$alist" is_executable
run "$alist" version; assert $state equals 0
}
@test 'asciigraph' { # Go package to make lightweight ASCII line graphs in command line apps with no external dependencies.
run zinit for @guptarohit/asciigraph; assert $state equals 0
local asciigraph="$ZBIN/asciigraph"; assert "$asciigraph" is_executable
run "$asciigraph" --help; assert $state equals 0
}
@test 'assh' { # make your ssh client smarter
run zinit for @moul/assh; assert $state equals 0
local assh="$ZBIN/assh"; assert "$assh" is_executable
run "$assh" --version; assert $state equals 0
}
@test 'atuin' { # Magical shell history
run zinit lbin'!atuin*->atuin' bpick'^*update*' for @atuinsh/atuin; assert $state equals 0
local atuin="$ZBIN/atuin"; assert "$atuin" is_executable
run "$atuin" --version; assert $state equals 0
}
@test 'aurora' { # Cross-platform beanstalkd queue server admin console
run zinit for @xuri/aurora; assert $state equals 0
local aurora="$ZBIN/aurora"; assert "$aurora" is_executable
run "$aurora" -v; assert $state equals 0
}
@test 'bandwhich' { # Terminal bandwidth utilization tool
[[ $OSTYPE =~ 'darwin*' ]] && skip "on $os_type"
run zinit for @imsnif/bandwhich; assert $state equals 0
local bandwhich="$ZBIN/bandwhich"; assert "$bandwhich" is_executable
run "$bandwhich" --version; assert $state equals 0
}
@test 'bat' { # A cat(1) clone with wings
run zinit for @sharkdp/bat; assert $state equals 0
local bat="$ZBIN/bat"; assert "$bat" is_executable
run "$bat" --version; assert $state equals 0
}
@test 'bazel' { # a fast, scalable, multi-language and extensible build system
run zinit lbin"!bazel* -> bazel" for @bazelbuild/bazel; assert $state equals 0
local bazel="$ZBIN/bazel"; assert "$bazel" is_executable
run "$bazel" --version; assert $state equals 0
}
@test 'blast' { # Blast is a simple tool for API load testing and batch jobs
[[ $OSTYPE =~ 'darwin*' ]] && skip "on $os_type"
run zinit for @dave/blast; assert $state equals 0
local blast="$ZBIN/blast"; assert "$blast" is_executable
run "$blast" --dry=1; assert $state equals 0
}
@test 'booklit' { # a pretty lit content authoring system
run zinit for lbin'!* -> booklit' @vito/booklit; assert $state equals 0
local booklit="$ZBIN/booklit"; assert "$booklit" is_executable
run "$booklit" --version; assert $state equals 0
}
@test 'bottom' { # Yet another cross-platform graphical process/system monitor
run zinit lbin'!btm' for ClementTsang/bottom; assert $state equals 0
local bottom="$ZBIN/btm"; assert "$bottom" is_executable
run "$bottom" --version; assert $state equals 0
}
@test 'broot' { # A new way to see and navigate directory trees
[[ $OSTYPE =~ 'darwin*' ]] && skip " on $os_type"
run zinit lbin"!*$MACHTYPE*$OSTYPE*/broot" for @Canop/broot; assert $state equals 0
local broot="$ZBIN/broot"; assert "$broot" is_executable
run "$broot" --version; assert $state equals 0
}
@test 'btop' { # A monitor of resources
run zinit ver'v1.2.13' for aristocratos/btop; assert $state equals 0
local btop="$ZBIN/btop"; assert "$btop" is_executable
run "$btop" --version; assert $state equals 0
}
@test 'calico' { # Cloud native networking and network security
run zinit lbin'!* -> calico' for @projectcalico/calico; assert $state equals 0
local calico="$ZBIN/calico"; assert "$calico" is_executable
run "$calico" version; assert $state equals 0
}
@test 'certificates' { # An opinionated helper for generating tls certificates
run zinit lbin'!* -> certificates' for @mvmaasakkers/certificates; assert $state equals 0
local certificates="$ZBIN/certificates"; assert "$certificates" is_executable
run "$certificates" --version; assert $state equals 0
}
@test 'checkmake' { # experimental linter/analyzer for Makefiles
run zinit lbin'!checkmake* -> checkmake' for @checkmake/checkmake; assert $state equals 0
local checkmake="$ZBIN/checkmake"; assert "$checkmake" is_executable
run $checkmake --version; assert $state equals 0
}
@test 'cosign' { # Container signing, verification and storage in an OCI registry
run zinit lbin'!* -> cosign' for @sigstore/cosign; assert $state equals 0
local cosign="$ZBIN/cosign"; assert "$cosign" is_executable
run $cosign version; assert $state equals 0
}
@test 'compress' { # Optimized Go Compression Packages
run zinit bpick'*.tar.gz' lbin'!s2c;s2d;s2sx;' for @klauspost/compress; assert $state equals 0
local compress="$ZBIN/s2c"; assert "$compress" is_executable
run $compress --help; assert $state equals 0
}
@test 'create-go-app' { # Create a new production-ready project with backend, frontend and deploy automation by running one CLI command
run zinit for id-as'cgapp' @create-go-app/cli; assert $state equals 0
local cgapp="$ZBIN/cgapp"; assert "$cgapp" is_executable
[[ $OSTYPE =~ 'darwin*' ]] && assert "$output" contains "darwin_${$(uname -m)//x86_/amd}" && pass
run $cgapp --version; assert $state equals 0
}
@test 'csview' { # Pretty csv viewer for cli with cjk/emoji support
run zinit for @wfxr/csview; assert $state equals 0
local csview="$ZBIN/csview"; assert "$csview" is_executable
run $csview --version; assert $state equals 0
}
@test 'dapr' { # Command-line tools for Dapr.
run zinit id-as'dapr' for @dapr/cli; assert $state equals 0
local cli="$ZBIN/dapr"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
@test 'delta' { # A syntax-highlighting pager for git, diff, and grep output
run zinit for @dandavison/delta; assert $state equals 0
local delta="$ZBIN/delta"; assert "$delta" is_executable
run $delta --version; assert $state equals 0
}
@test 'difftastic' { # A structural diff that understands syntax
run zinit lbin'!difft' for @Wilfred/difftastic; assert $state equals 0
local difftastic="$ZBIN/difft"; assert "$difftastic" is_executable
run $difftastic --version; assert $state equals 0
}
@test 'dive' { # A tool for exploring each layer in a docker image
run zinit for @wagoodman/dive; assert $state equals 0
local dive="$ZBIN/dive"; assert "$dive" is_executable
run $dive --version; assert $state equals 0
}
@test 'docker-buildx' { # A monitor of resources
run zinit for lbin'!* -> buildx' @docker/buildx; assert $state equals 0
local buildx="$ZBIN/buildx"; assert "$buildx" is_executable
run $buildx version; assert $state equals 0
}
@test 'docker-compose' { # Define and run multi-container applications with Docker
run zinit lbin'!* -> docker-compose' for @docker/compose; assert $state equals 0
local dc="$ZBIN/docker-compose"; assert "$dc" is_executable
run $dc --version; assert $state equals 0
}
@test 'docker-credential-helpers' { # A monitor of resources
[[ $OSTYPE =~ 'linux*' ]] && skip "on $os_type"
run zinit for lbin'!* -> docker-credential-desktop' @docker/docker-credential-helpers; assert $state equals 0
local credential_desktop="$ZBIN/docker-credential-desktop"; assert "$credential_desktop" is_executable
run $credential_desktop version; assert $state equals 0
}
@test 'documize' { # Modern Confluence alternative designed for internal & external docs, built with Go & Ember JS
run zinit lbin'!* -> documize' for @documize/community; assert $state equals 0
local documize="$ZBIN/documize"; assert "$documize" is_executable
run $documize version; assert $state equals 0
}
@test 'dstask' { # Git powered terminal-based todo/note manager -- markdown note page per task
run zinit lbin'!*->dstask' bpick'^*import*' for @naggie/dstask; assert $state equals 0
local dstask="$ZBIN/dstask"; assert "$dstask" is_executable
run $dstask version; assert $state equals 0
}
@test 'dua' { # View disk space usage and delete unwanted data, fast
run zinit ver'v2.20.3' lbin'!dua' for @Byron/dua-cli; assert $state equals 0
local dua="$ZBIN/dua"; assert "$dua" is_executable
run $dua --version; assert $state equals 0
}
@test 'duci' { # The simple CI server
run zinit for @duck8823/duci; assert $state equals 0
local duci="$ZBIN/duci"; assert "$duci" is_executable
run $duci version; assert $state equals 0
}
@test 'dust' { # A more intuitive version of du in rust
run zinit for @bootandy/dust; assert $state equals 0
local dust="$ZBIN/dust"; assert "$dust" is_executable
run $dust --version; assert $state equals 0
}
@test 'dyff' { # diff tool for YAML files, and sometimes JSON
run zinit for @homeport/dyff; assert $state equals 0
local dyff="$ZBIN/dyff"; assert "$dyff" is_executable
run $dyff version; assert $state equals 0
}
@test 'dysk' { # A linux utility to get information on filesystems, like df but better
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
run zinit lbin"!**/$arch*$os_type/* -> dysk" for @Canop/dysk; assert $state equals 0
local dysk="$ZBIN/dysk"; assert "$dysk" is_executable
run $dysk --version; assert $state equals 0
}
@test 'etcd' { # Distributed reliable key-value store for the most critical data of a distributed system
run zinit for @etcd-io/etcd; assert $state equals 0
local etcd="$ZBIN/etcd"; assert "$etcd" is_executable
run $etcd --version; assert $state equals 0
}
@test 'exa' { # A modern replacement for ls
run zinit for @ogham/exa; assert $state equals 0
local exa="$ZBIN/exa"; assert "$exa" is_executable
run $exa --version; assert $state equals 0
}
@test 'fclones' { # Efficient duplicate file Finder
[[ $OSTYPE =~ 'darwin*' ]] && skip "on $os_type"
run zinit ver'v0.31.0' for @pkolaczk/fclones; assert $state equals 0
local fclones="$ZBIN/fclones"; assert "$fclones" is_executable
run "$fclones" --version; assert $state equals 0
}
@test 'fd' { # A fast, simple, and user-friendly alternative to find
run zinit for @sharkdp/fd; assert $state equals 0
local fd="$ZBIN/fd"; assert "$fd" is_executable
run $fd version; assert $state equals 0
}
@test 'fnm' { # Fast and simple Node.js version manager, built in Rust
run zinit for @Schniz/fnm; assert $state equals 0
local fnm="$ZBIN/fnm"; assert "$fnm" is_executable
run $fnm --version; assert $state equals 0
}
@test 'fogg' { # Manage Infrastructure as Code with less pain
run zinit ver'v0.92.1' for @chanzuckerberg/fogg; assert $state equals 0
local fogg="$ZBIN/fogg"; assert "$fogg" is_executable
run $fogg version; assert $state equals 0
}
@test 'fx' { # Terminal JSON viewer
run zinit lbin'!* -> fx' ver'32.0.0' for @antonmedv/fx; assert $state equals 0
local fx="$ZBIN/fx"; assert "$fx" is_executable
run $fx -v; assert $state equals 0
}
@test 'fzf' { # A command-line fuzzy finder
run zinit for @junegunn/fzf; assert $state equals 0
local fzf="$ZBIN/fzf"; assert "$fzf" is_executable
run $fzf --version; assert $state equals 0
}
@test 'gdu' { # Fast disk usage analyzer with console interface written in Go
run zinit lbin'!* -> gdu' for @dundee/gdu; assert $state equals 0
local gdu="$ZBIN/gdu"; assert "$gdu" is_executable
run $gdu --version; assert $state equals 0
}
@test 'gf' { # Fast disk usage analyzer with console interface written in Go
run zinit lbin'!* -> gf' for @gogf/gf; assert $state equals 0
local gf="$ZBIN/gf"; assert "$gf" is_executable
run $gf --version; assert $state equals 0
}
@test 'ggsrun' { # This is a CLI tool to execute Google Apps Script (GAS) at own terminal on local PC. Also this CLI tool can be used for managing files in Google Drive for OAuth2 and Service Account
run zinit lbin'!* -> ggsrun' ver'v2.0.0' for @tanaikech/ggsrun; assert $state equals 0
local git_sizer="$ZBIN/ggsrun"; assert "$git_sizer" is_executable
run $git_sizer --version; assert $state equals 0
}
@test 'gh-cli' { # GitHubs official command line tool
run zinit lbin'!gh' for @cli/cli; assert $state equals 0
local gh_cli="$ZBIN/gh"; assert "$gh_cli" is_executable
run $gh_cli --version; assert $state equals 0
}
@test 'gh-hub' { # A command-line tool that makes git easier to use with GitHub
run zinit cp"hub-*/etc/hub.zsh_completion -> _hub" for @mislav/hub; assert $state equals 0
local hub="$ZBIN/hub"; assert "$hub" is_executable
run $hub --version; assert $state equals 0
}
@test 'ghg' { # Get the executable from github releases easily
run zinit for @Songmu/ghg; assert $state equals 0
local ghg="$ZBIN/ghg"; assert "$ghg" is_executable
run "$ghg" version; assert $state equals 0
}
@test 'ghq' { # Remote repository management made easy
run zinit for @x-motemen/ghq; assert $state equals 0
local ghq="$ZBIN/ghq"; assert "$ghq" is_executable
run "$ghq" --version; assert $state equals 0
}
@test 'git-absorb' { # git commit --fixup, but automatic
run zinit for @tummychow/git-absorb; assert $state equals 0
local git_absorb="$ZBIN/git-absorb"; assert "$git_absorb" is_executable
run "$git_absorb" --version; assert $state equals 0
}
@test 'git-cliff' { # CHANGELOG generator implemented in Go (Golang).
run zinit for @orhun/git-cliff; assert $state equals 0
local git_cliff="$ZBIN/git-cliff"; assert "$git_cliff" is_executable
run "$git_cliff" --version; assert $state equals 0
}
@test 'git-mkver' { # Automatic Semantic Versioning for git based software development
run zinit ver'v1.2.2' for @idc101/git-mkver; assert $state equals 0
local git_mkver="$ZBIN/git-mkver"; assert "$git_mkver" is_executable
run "$git_mkver" info; assert $state equals 0
}
@test 'git-sizer' { # Compute various size metrics for a Git repository, flagging those that might cause problems
run zinit for @github/git-sizer; assert $state equals 0
local git_sizer="$ZBIN/git-sizer"; assert "$git_sizer" is_executable
run "$git_sizer" --version; assert $state equals 0
}
@test 'gitui' { # Blazing fast terminal-ui for git written in rust
run zinit for @gitui-org/gitui; assert $state equals 0
local gitui="$ZBIN/gitui"; assert "$gitui" is_executable
run "$gitui" --version; assert $state equals 0
}
@test 'glow' { # Render markdown on the CLI, with pizzazz
run zinit for @charmbracelet/glow; assert $state equals 0
local git_sizer="$ZBIN/glow"; assert "$git_sizer" is_executable
run $git_sizer --version; assert $state equals 0
}
@test 'go-james' { # James is your butler and helps you to create, build, debug, test and run your Go projects
run zinit for @pieterclaerhout/go-james; assert $state equals 0
local git_sizer="$ZBIN/go-james"; assert "$git_sizer" is_executable
run $git_sizer version; assert $state equals 0
}
@test 'go-swagger' { # Swagger 2.0 implementation for go
run zinit lbin'!* -> go-swagger' for @go-swagger/go-swagger; assert $state equals 0
local git_sizer="$ZBIN/go-swagger"; assert "$git_sizer" is_executable
run $git_sizer version; assert $state equals 0
}
@test 'gojq' { # Pure Go implementation of jq
run zinit for @itchyny/gojq; assert $state equals 0
local git_sizer="$ZBIN/gojq"; assert "$git_sizer" is_executable
run $git_sizer --version; assert $state equals 0
}
@test 'gomi' { # Replacement for UNIX rm command
run zinit for @babarot/gomi; assert $state equals 0
local gomi="$ZBIN/gomi"; assert "$gomi" is_executable
run $gomi --version; assert $state equals 0
}
@test 'gosu' { # Simple Go-based setuid+setgid+setgroups+exec
[[ $OSTYPE =~ "darwin*" ]] && skip "on $os_type"
run zinit lbin'!* -> gosu' for @tianon/gosu; assert $state equals 0
local gosu="$ZBIN/gosu"; assert "$gosu" is_executable
run $gosu --version; assert $state equals 0
}
@test 'got' { # Simple golang package and CLI tool to download large files faster than cURL and Wget
run zinit for @melbahja/got; assert $state equals 0
local got="$ZBIN/got"; assert "$got" is_executable
run $got --version; assert $state equals 0
}
@test 'gotestfmt' { # go test output for humans
run zinit for @GoTestTools/gotestfmt; assert $state equals 0
local gotestfmt="$ZBIN/gotestfmt"; assert "$gotestfmt" is_executable
run $gotestfmt --help; assert $state equals 0
}
@test 'gothanks' { # go test output for humans
run zinit for @psampaz/gothanks; assert $state equals 0
local gothanks="$ZBIN/gothanks"; assert "$gothanks" is_executable
run $gothanks --help; assert $state equals 0
}
@test 'grex' { # A command-line tool and library for generating regular expressions from user-provided test cases
run zinit for @pemistahl/grex; assert $state equals 0
local grex="$ZBIN/grex"; assert "$grex" is_executable
run $grex --version; assert $state equals 0
}
@test 'gron' { # go test output for humans
run zinit for @tomnomnom/gron; assert $state equals 0
local gron="$ZBIN/gron"; assert "$gron" is_executable
run $gron --version; assert $state equals 0
}
@test 'hadolint' { # Dockerfile linter, validate inline bash, written in Haskell
run zinit ver'v2.12.1-beta' lbin'!hadolint* -> hadolint' for @hadolint/hadolint; assert $state equals 0
local hadolint="$ZBIN/hadolint"; assert "$hadolint" is_executable
run $hadolint --version; assert $state equals 0
}
# TODO: gh-r does not find older assets anymore (possible bug from https://github.com/zdharma-continuum/zinit/pull/373)
@test 'heksa' { # CLI hex dumper with colors
[[ $OSTYPE =~ "darwin*" ]] && skip "on $os_type"
run zinit for @raspi/heksa; assert $state equals 0
local heksa="$ZBIN/heksa"; assert "$heksa" is_executable
run $heksa --version; assert $state equals 0
}
@test 'helix' { # A post-modern modal text editor
run zinit lbin'!hx' for @helix-editor/helix; assert $state equals 0
local helix="$ZBIN/hx"; assert "$helix" is_executable
run $helix --version; assert $state equals 0
}
@test 'hexyl' { # A command-line hex viewer
run zinit for @sharkdp/hexyl; assert $state equals 0
local hexyl="$ZBIN/hexyl"; assert "$hexyl" is_executable
run $hexyl --version; assert $state equals 0
}
@test 'hoofli' { # Generate PlantUML diagrams from Chrome or Firefox network inspection
run zinit lbin'!* -> hoofli' for @dnnrly/hoofli; assert $state equals 0
local hoofli="$ZBIN/hoofli"; assert "$hoofli" is_executable
run $hoofli -h; assert $state equals 0
}
@test 'hors' { # instant coding answers via the command line
[[ $OSTYPE =~ "linux*" ]] && skip "skipped on $os_type"
run zinit for @WindSoilder/hors; assert $state equals 0
local hors="$ZBIN/hors"; assert "$hors" is_executable
run $hors --version; assert $state equals 0
}
@test 'htmlq' { # Like jq, but for HTML
run zinit for @mgdm/htmlq; assert $state equals 0
local htmlq="$ZBIN/htmlq"; assert "$htmlq" is_executable
run "$htmlq" --version; assert $state equals 0
}
@test 'hyperfine' { # A command-line benchmarking tool
run zinit bpick'*tar.gz*' for @sharkdp/hyperfine; assert $state equals 0
local hyperfine="$ZBIN/hyperfine"; assert "$hyperfine" is_executable
run $hyperfine --version; assert $state equals 0
}
@test 'igo' { # Improved Go Syntax (transpiler)
run zinit for @rocketlaunchr/igo; assert $state equals 0
local igo="$ZBIN/igo"; assert "$igo" is_executable
run $igo version; assert $state equals 0
}
@test 'insect' { # High precision scientific calculator with support for physical units
run zinit ver'v5.7.0' lbin'!* -> insect' for @sharkdp/insect; assert $state equals 0
local insect="$ZBIN/insect"; assert "$insect" is_executable
run $insect help; assert $state equals 0
}
@test 'ipinfo' { # Official Command Line Interface for the IPinfo API (IP geolocation and other types of IP data)
run zinit for id-as'ipinfo' lbin'!*->ipinfo' @ipinfo/cli; assert $state equals 0
local cli="$ZBIN/ipinfo"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
@test 'joincap' { # Merge multiple pcap files together, gracefully
run zinit lbin'!* -> joincap' for @assafmo/joincap; assert $state equals 0
local joincap="$ZBIN/joincap"; assert "$joincap" is_executable
run $joincap --version; assert $state equals 0
}
@test 'jq' { # Command-line JSON processor
run zinit lbin'!* -> jq' for jqlang/jq; assert $state equals 0
local jq="$ZBIN/jq"; assert "$jq" is_executable
run $jq --version; assert $state equals 0
}
@test 'just' { # Just a command runner
run zinit for @casey/just; assert $state equals 0
local just="$ZBIN/just"; assert "$just" is_executable
run $just --version; assert $state equals 0
}
# @test 'keepassxc' { # a cross-platform community-driven port of the Windows application Keepass Password Safe
# [[ $OSTYPE =~ 'linux*' ]] && skip "skipped on $os_type"
# run zinit for lbin'!*-cli -> keepassxc-cli' @keepassxreboot/keepassxc; assert $state equals 0
# local keepassxc="$ZBIN/keepassxc-cli"; assert "$keepassxc" is_executable
# run $keepassxc --version; assert $state equals 0
# }
@test 'ko' { # Build and deploy Go applications on Kubernetes
run zinit for @ko-build/ko; assert $state equals 0
local ko="$ZBIN/ko"; assert "$ko" is_executable
run $ko version; assert $state equals 0
}
@test 'kopia' { # Cross-platform backup tool with fast, incremental backups, client-side end-to-end encryption, compression and data deduplication
run zinit for @kopia/kopia; assert $state equals 0
local kopia="$ZBIN/kopia"; assert "$kopia" is_executable
run $kopia --version; assert $state equals 0
}
@test 'krew' { # Build and deploy Go applications on Kubernetes
run zinit lbin'!krew* -> krew' for @kubernetes-sigs/krew; assert $state equals 0
local krew="$ZBIN/krew"; assert "$krew" is_executable
run $krew version; assert $state equals 0
}
@test 'kubectl-plugins' { # Faster way to switch between clusters and namespaces in kubectl
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
load_bin_gem_node
run zinit for bpick'kubectx;kubens' sbin'kubectx;kubens' @ahmetb/kubectx
local bin prog
for bin in 'kubectx' 'kubens'; do
prog="$ZBIN/${bin}"; assert "$prog" is_executable;
run "$prog" --help; assert $state equals 0
done
}
@test 'kubedb' { # `kubectl` plugin for KubeDB
run zinit for lbin'!kube*->kubedb' @kubedb/cli; assert $state equals 0
local cli="$ZBIN/kubedb"; assert "$cli" is_executable
run "$cli" version; assert $state equals 0
}
@test 'lazygit' { # simple terminal UI for git commands
run zinit for @jesseduffield/lazygit; assert $state equals 0
local lazygit="$ZBIN/lazygit"; assert "$lazygit" is_executable
run $lazygit --version; assert $state equals 0
}
@test 'lemmeknow' { # The fastest way to identify anything
run zinit lbin'!* -> lemmeknow' for @swanandx/lemmeknow; assert $state equals 0
local lemmeknow="$ZBIN/lemmeknow"; assert "$lemmeknow" is_executable
run "$lemmeknow" --version; assert $state equals 0
}
@test 'lf' { # Terminal file manager
run zinit for @gokcehan/lf; assert $state equals 0
local lf="$ZBIN/lf"; assert "$lf" is_executable
run $lf -version; assert $state equals 0
}
@test 'lnav' { # advanced log file viewer
run zinit for @tstack/lnav; assert $state equals 0
local lnav="$ZBIN/lnav"; assert "$lnav" is_executable
run $lnav --version; assert $state equals 0
}
@test 'lsd' { # The next gen ls command
run zinit for @lsd-rs/lsd; assert $state equals 0
local lsd="$ZBIN/lsd"; assert "$lsd" is_executable
run $lsd --version; assert $state equals 0
}
@test 'lstf' { # The aggregated TCP flows printer in Linux
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
run zinit for @yuuki/lstf; assert $state equals 0
local lstf="$ZBIN/lstf"; assert "$lstf" is_executable
run $lstf --version; assert $state equals 0
}
@test 'macchina' { # A system information frontend with an emphasis on performance
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
run zinit lbin'!* -> macchina' for @macchina-cli/macchina; assert $state equals 0
local macchina="$ZBIN/macchina"; assert "$macchina" is_executable
run $macchina --version; assert $state equals 0
}
@test 'mage' { # A Make/rake-like dev tool using Go
run zinit for @magefile/mage; assert $state equals 0
local mage="$ZBIN/mage"; assert "$mage" is_executable
run $mage -version; assert $state equals 0
}
@test 'mcfly' { # Fly through your shell history. Great Scott
run zinit ver'v0.8.3' for @cantino/mcfly; assert $state equals 0
local mcfly="$ZBIN/mcfly"; assert "$mcfly" is_executable
run "$mcfly" --version; assert $state equals 0
}
@test 'mdbook-lbin' { # Create book from markdown files. Like Gitbook but implemented in Rust
local mdbook="$ZBIN/mdbook";
run zinit for @rust-lang/mdBook; assert $state equals 0 assert "$mdbook" is_executable
run "$mdbook" --version; assert $state equals 0
run command file "$(command realpath ${mdbook})"; assert $output contains 'executable'
run zinit delete --yes rust-lang/mdBook; assert $state equals 0
run "$mdbook" --version;
assert $state equals 127; assert $output contains 'no such file or directory'
}
@test 'mdbook-sbin' { # Create book from markdown files. Like Gitbook but implemented in Rust
load_bin_gem_node
local mdbook="$ZBIN/mdbook";
run zinit from'gh-r' sbin"mdbook" for @rust-lang/mdBook; assert $state equals 0 assert "$mdbook" is_executable
run "$mdbook" --version; assert $state equals 0
run command file "$(command realpath ${mdbook})";
assert $output contains 'zsh script'; assert $output contains 'ASCII text'
run zinit delete --yes rust-lang/mdBook; assert $state equals 0
run "$mdbook" --version;
assert $state equals 127; assert $output contains 'no such file or directory'
}
@test 'micro' { # A modern and intuitive terminal-based text editor
run zinit for @micro-editor/micro; assert $state equals 0
local micro="$ZBIN/micro"; assert "$micro" is_executable
run $micro --version; assert $state equals 0
}
@test 'miniserve' { # For when you really just want to serve some files over HTTP right now!
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
run zinit lbin'!* -> miniserve' for @svenstaro/miniserve; assert $state equals 0
local miniserve="$ZBIN/miniserve"; assert "$miniserve" is_executable
run $miniserve --version; assert $state equals 0
}
@test 'mkcert' { # A simple zero-config tool to make locally trusted development certificates
run zinit lbin'!* -> mkcert' for @FiloSottile/mkcert; assert $state equals 0
local mkcert="$ZBIN/mkcert"; assert "$mkcert" is_executable
run $mkcert --version; assert $state equals 0
}
@test 'mmake' { # A Make/rake-like dev tool using Go
run zinit for ver'v1.4.0' @tj/mmake; assert $state equals 0
local mmake="$ZBIN/mmake"; assert "$mmake" is_executable
run $mmake --version; assert $state equals 0
}
@test 'mmv' { # rename multiple files with editor
run zinit for @itchyny/mmv; assert $state equals 0
local mmv="$ZBIN/mmv"; assert "$mmv" is_executable
run $mmv --version; assert $state equals 0
}
@test 'mob' { # rename multiple files with editor
run zinit for @remotemobprogramming/mob; assert $state equals 0
local mob="$ZBIN/mob"; assert "$mob" is_executable
run $mob --version; assert $state equals 0
}
@test 'mocword' { # Predict next words
run zinit lbin'!mocword* -> mocword' for @high-moctane/mocword; assert $state equals 0
local mocword="$ZBIN/mocword"; assert "$mocword" is_executable
run $mocword --version; assert $state equals 0
}
@test 'monolith' { # CLI tool for saving complete web pages as a single HTML file
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
run zinit lbin'!* -> monolith' for @Y2Z/monolith; assert $state equals 0
local monolith="$ZBIN/monolith"; assert "$monolith" is_executable
run $monolith --version; assert $state equals 0
}
@test 'moonwalk' { # Cover your tracks during Linux Exploitation by leaving zero traces on system logs and filesystem timestamps
run zinit lbin'!moonwalk* -> moonwalk' for @mufeedvh/moonwalk; assert $state equals 0
local moonwalk="$ZBIN/moonwalk"; assert "$moonwalk" is_executable
run $moonwalk --version; assert $state equals 0
}
@test 'navi' { # An interactive cheatsheet tool for the command-line
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
run zinit lbin'!* -> navi' for @denisidoro/navi; assert $state equals 0
local navi="$ZBIN/navi"; assert "$navi" is_executable
run $navi --version; assert $state equals 0
}
@test 'onefetch' { # Git repository summary on your terminal
run zinit for @o2sh/onefetch; assert $state equals 0
local onefetch="$ZBIN/onefetch"; assert "$onefetch" is_executable
run $onefetch --version; assert $state equals 0
}
@test 'ollama' { # Get up and running with large language models
# The suite's only `.tar.zst' release asset. darwin ships a `.tgz', so the
# zstd extraction path is reachable on Linux only. bpick drops the
# accelerator builds (mlx/rocm/jetpack), which sort ahead of the plain one.
[[ $OSTYPE =~ 'darwin*' ]] && skip "no .tar.zst asset on $os_type"
(( ${+commands[zstd]} )) || skip 'zstd not installed'
run zinit id-as lbin'!ollama' bpick'^*(mlx|rocm|jetpack)*' for @ollama/ollama; assert $state equals 0
assert $output does_not_contain 'ERROR'
assert $output does_not_contain "didn't recognize archive type"
local ollama="$ZBIN/ollama"; assert "$ollama" is_executable
run "$ollama" --version; assert $state equals 0
}
@test 'ouch' { # Painless compression and decompression for your terminal
run zinit for @ouch-org/ouch; assert $state equals 0
local ouch="$ZBIN/ouch"; assert "$ouch" is_executable
run "$ouch" --version; assert $state equals 0
}
@test 'pastel' { # A command-line tool to generate, analyze, convert and manipulate colors
run zinit for @sharkdp/pastel; assert $state equals 0
local pastel="$ZBIN/pastel"; assert "$pastel" is_executable
run "$pastel" --version; assert $state equals 0
}
@test 'peco' { # Simplistic interactive filtering tool
run zinit for @peco/peco; assert $state equals 0
local peco="$ZBIN/peco"; assert "$peco" is_executable
run $peco --version; assert $state equals 0
}
@test 'piknik' { # Copy/paste anything over the network
run zinit for @jedisct1/piknik; assert $state equals 0
local piknik="$ZBIN/piknik"; assert "$piknik" is_executable
run $piknik --version; assert $state equals 0
}
@test 'pipr' { # A tool to interactively write shell pipelines.
[[ $OSTYPE =~ 'darwin*' ]] && skip "skipped on $os_type"
run zinit for @Elkowar/pipr; assert $state equals 0
local pipr="$ZBIN/pipr"; assert "$pipr" is_executable
run "$pipr" --help; assert $state equals 0
}
@test 'pmy' { # General purpose context-aware zsh completion engine powered by fuzzy finder
run zinit for @relastle/pmy; assert $state equals 0
local pmy="$ZBIN/pmy"; assert "$pmy" is_executable
run "$pmy" --version; assert $state equals 0
}
@test 'procs' { # A modern replacement for ps written in Rust
run zinit for @dalance/procs; assert $state equals 0
local procs="$ZBIN/procs"; assert "$procs" is_executable
run "$procs" --version; assert $state equals 0
}
@test 'pulumi' { # A modern replacement for ps written in Rust
run zinit for @pulumi/pulumi; assert $state equals 0
local pulumi="$ZBIN/pulumi"; assert "$pulumi" is_executable
run "$pulumi" version; assert $state equals 0
}
@test 'qsv' { # Blazing-fast Data-Wrangling toolkit
run zinit for @dathere/qsv; assert $state equals 0
local qsv="$ZBIN/qsv"; assert "$qsv" is_executable
run "$qsv" --version; assert $state equals 0
}
@test 'rancher' { # Rancher CLI
run zinit for id-as'rancher' @rancher/cli; assert $state equals 0
local cli="$ZBIN/rancher"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
@test 'rare' { # Realtime regex-extraction and aggregation into common formats such as histograms, bar graphs, tables, etc
run zinit for @zix99/rare; assert $state equals 0
local rare="$ZBIN/rare"; assert "$rare" is_executable
run "$rare" --version; assert $state equals 0
}
@test 'rargs' { # xargs + awk with pattern matching support
run zinit for @lotabout/rargs; assert $state equals 0
local rargs="$ZBIN/rargs"; assert "$rargs" is_executable
run "$rargs" --version; assert $state equals 0
}
@test 'rclone' { # Realtime regex-extraction and aggregation into common formats such as histograms, bar graphs, tables, etc
run zinit for @rclone/rclone; assert $state equals 0
local rclone="$ZBIN/rclone"; assert "$rclone" is_executable
run "$rclone" --version; assert $state equals 0
}
@test 'reg' { # Docker registry v2 command line client and repo listing generator with security checks
run zinit lbin'!* -> reg' for @genuinetools/reg; assert $state equals 0
local reg="$ZBIN/reg"; assert "$reg" is_executable
run "$reg" version; assert $state equals 0
}
# TODO: gh-r does not find older assets anymore (possible bug from https://github.com/zdharma-continuum/zinit/pull/373)
@test 'rip' { # A safe and ergonomic alternative to rm
run zinit ver'0.11.3' for @nivekuil/rip; assert $state equals 0
local rip="$ZBIN/rip"; assert "$rip" is_executable
run "$rip" --version; assert $state equals 0
}
@test 'ripgrep' { # Recursively searches directories for a regex pattern while respecting your gitignore
run zinit lbin'!rg' for @BurntSushi/ripgrep; assert $state equals 0
local rg="$ZBIN/rg"; assert "$rg" is_executable
run "$rg" --version; assert $state equals 0
}
@test 'ripsecrets' { # A command-line tool to prevent committing secret keys into your source code
run zinit for @sirwart/ripsecrets; assert $state equals 0
local ripsecrets="$ZBIN/ripsecrets"; assert "$ripsecrets" is_executable
run "$ripsecrets" --version; assert $state equals 0
}
@test 'rnr' { # A command-line tool to batch rename files and directories
run zinit for @ismaelgv/rnr; assert $state equals 0
local rnr="$ZBIN/rnr"; assert "$rnr" is_executable
run "$rnr" --version; assert $state equals 0
}
@test 'rust-analyzer' { # A Rust compiler front-end for IDEs
[[ $OSTYPE =~ "linux*" ]] && skip "skipped on $os_type"
run zinit lbin'!* -> rust-analyzer' for @rust-lang/rust-analyzer; assert $state equals 0
local rust_analyzer="$ZBIN/rust-analyzer"; assert "$rust_analyzer" is_executable
run "$rust_analyzer" --version; assert $state equals 0
}
@test 's' { # Open a web search in your terminal
run zinit for @zquestz/s; assert $state equals 0
local s="$ZBIN/s"; assert "$s" is_executable
run "$s" --version; assert $state equals 0
}
@test 'sd' { # Intuitive find & replace CLI a.k.a modern sed
run zinit for @chmln/sd; assert $state equals 0
local sd="$ZBIN/sd"; assert "$sd" is_executable
run "$sd" --version; assert $state equals 0
}
@test 'shellcheck' { # a static analysis tool for shell scripts
run zinit for @koalaman/shellcheck; assert $state equals 0
local shellcheck="$ZBIN/shellcheck"; assert "$shellcheck" is_executable
run "$shellcheck" --version; assert $state equals 0
}
@test 'shfmt' { # A shell parser, formatter, and interpreter with bash support
run zinit lbin'!sh* -> shfmt' for @mvdan/sh; assert $state equals 0
local shfmt="$ZBIN/shfmt"; assert "$shfmt" is_executable
run $shfmt --version; assert $state equals 0
}
@test 'skim' { # Fuzzy Finder in rust
run zinit for lbin'!sk->sk' @skim-rs/skim; assert $state equals 0
local skim="$ZBIN/sk"; assert "$skim" is_executable
run "$skim" --version; assert $state equals 0
}
@test 'snm' { # Smol and simple node version manager written in rust
run zinit for @numToStr/snm; assert $state equals 0
local snm="$ZBIN/snm"; assert "$snm" is_executable
run "$snm" --version; assert $state equals 0
}
@test 'starship' { # The minimal, blazing-fast, and infinitely customizable prompt for any shell
run zinit for @starship/starship; assert $state equals 0
local starship="$ZBIN/starship"; assert "$starship" is_executable
run "$starship" --version; assert $state equals 0
}
@test 'step' { # A zero trust swiss army knife for working with X509, OAuth, JWT, OATH OTP, etc.
run zinit for id-as'step' @smallstep/cli; assert $state equals 0
local cli="$ZBIN/step"; assert "$cli" is_executable
run "$cli" --version; assert $state equals 0
}
@test 'stern' { # Multi pod and container log tailing for Kubernetes
run zinit for @stern/stern; assert $state equals 0
local stern="$ZBIN/stern"; assert "$stern" is_executable
run "$stern" --version; assert $state equals 0
}
@test 'tealdeer' { # A very fast implementation of tldr in Rust
run zinit lbin'!tealdeer* -> tealdeer' for @tealdeer-rs/tealdeer; assert $state equals 0
local tealdeer="$ZBIN/tealdeer"; assert "$tealdeer" is_executable
run "$tealdeer" --version; assert $state equals 0
}
@test 'tin-summer' { # Find build artifacts that are taking up disk space
run zinit for @vmchale/tin-summer; assert $state equals 0
local tin_summer="$ZBIN/sn"; assert "$tin_summer" is_executable
run "$tin_summer" --version; assert $state equals 0
}
@test 'tokei' { # Count your code, quickly.
run zinit lbin'!*tokei -> tokei' ver'v12.1.1' for @XAMPPRocky/tokei; assert $state equals 0
local tokei="$ZBIN/tokei"; assert "$tokei" is_executable
run $tokei --version; assert $state equals 0
}
@test 'topgrade' { # Upgrade everything
run zinit for @r-darwish/topgrade; assert $state equals 0
local topgrade="$ZBIN/topgrade"; assert "$topgrade" is_executable
run $topgrade --version; assert $state equals 0
}
@test 'tre' { # Tree command, improved
run zinit for @dduan/tre; assert $state equals 0
local tre="$ZBIN/tre"; assert "$tre" is_executable
run $tre --version; assert $state equals 0
}
@test 'up' { # Deploy infinitely scalable serverless apps, apis, and sites in seconds to AWS
run zinit lbin'!up* -> up' for akavel/up; assert $state equals 0
local up="$ZBIN/up"; assert "$up" is_executable
run $up -h; assert $output contains "up is the Ultimate Plumber"
}
@test 'volta-cli' { # JS Toolchains as Code
[[ "$OSTYPE" =~ 'linux*' ]] && skip 'Volta CLI skipped on Linux'
export VOLTA_HOME="${ZPFX}/bin"
run zinit lbin'volta;volta-migrate' for @volta-cli/volta; assert $state equals 0
local volta="$ZBIN/volta"; assert "$volta" is_executable
run $volta --version; assert $state equals 0
}
@test 'watchexec' { # Executes commands in response to file modifications
run zinit for @watchexec/watchexec; assert $state equals 0
local watchexec="$ZBIN/watchexec"; assert "$watchexec" is_executable
run "$watchexec" --version; assert $state equals 0
}
@test 'whalebrew' { # Homebrew, but with Docker images
run zinit lbin'!* -> whalebrew' for whalebrew/whalebrew; assert $state equals 0
local whalebrew="$ZBIN/whalebrew"; assert "$whalebrew" is_executable
run $whalebrew version; assert $state equals 0
}
@test 'wifiqr' { # Create a QR code with your Wi-Fi login details
run zinit lbin'!* -> wifiqr' for reugn/wifiqr; assert $state equals 0
local wifiqr="$ZBIN/wifiqr"; assert "$wifiqr" is_executable
run $wifiqr --version; assert $state equals 0
}
@test 'wtf' { # The personal information dashboard for your terminal
run zinit lbin'!wtf* -> wtf' for wtfutil/wtf; assert $state equals 0
local wtf="$ZBIN/wtf"; assert "$wtf" is_executable
run $wtf --version; assert $state equals 0
}
@test 'xh' { # Friendly and fast tool for sending HTTP requests
run zinit for @ducaale/xh; assert $state equals 0
local xh="$ZBIN/xh"; assert "$xh" is_executable
run $xh --version; assert $state equals 0
}
@test 'xsv' { # A fast CSV command line toolkit written in Rust.
run zinit for @BurntSushi/xsv; assert $state equals 0
local xsv="$ZBIN/xsv"; assert "$xsv" is_executable
run "$xsv" --version; assert $state equals 0
}
@test 'yabai' { # A tiling window manager for macOS based on binary space partitioning
[[ $OSTYPE =~ 'linux*' ]] && skip 'Yabai skipped on Linux'
run zinit for @asmvik/yabai; assert $state equals 0
local yabai="$ZBIN/yabai"; assert "$yabai" is_executable
run $yabai --version; assert $state equals 0
}
@test 'yq' { # a portable command-line YAML, JSON and XML processor
run zinit lbin'!* -> yq' for @mikefarah/yq; assert $state equals 0
local yq="$ZBIN/yq"; assert "$yq" is_executable
run $yq --version; assert $state equals 0
}
@test 'zed' { # Tooling for super-structured data: a new and easier way to manipulate data
skip "Official Doc: SuperDB is still under development so there's not yet a GA release."
run zinit for @brimdata/super; assert $state equals 0
local zed="$ZBIN/zed"; assert "$zed" is_executable
run $zed --version; assert $state equals 0
}
@test 'zoxide' { # A smarter cd command
run zinit for @ajeetdsouza/zoxide; assert $state equals 0
local zoxide="$ZBIN/zoxide"; assert "$zoxide" is_executable
run $zoxide --version; assert $state equals 0
}
@test 'extract-bang with gh-r' { # extract'!' should extract exactly once via ∞zinit-extract-hook
run zinit from'gh-r' extract'!' id-as'bat/extract-bang' for @sharkdp/bat
assert $state equals 0
assert $output does_not_contain 'ERROR'
assert $output does_not_contain "doesn't exist"
local bat="$ZBIN/bat"; assert "$bat" is_executable
run "$bat" --version; assert $state equals 0
}
@test 'extract-bang-bang with gh-r' { # extract'!!' flattens two levels: hub-ver/bin/hub → hub at root
# hub archive: hub-darwin-amd64-X.Y.Z/bin/hub (3 levels deep, requires !!)
run zinit from'gh-r' extract'!!' id-as'hub/extract-bangbang' for @mislav/hub
assert $state equals 0
assert $output does_not_contain 'ERROR'
assert $output does_not_contain "doesn't exist"
local hub="$ZBIN/hub"; assert "$hub" is_executable
run "$hub" --version; assert $state equals 0
}
@test 'extract-bang update with gh-r' { # extract hook must run after download, not before
# Install bat with extract'!'
run zinit from'gh-r' extract'!' id-as'bat/extract-update' for @sharkdp/bat
assert $state equals 0
assert $output does_not_contain 'ERROR'
assert $output does_not_contain "doesn't exist"
local bat="$ZBIN/bat"; assert "$bat" is_executable
# Tamper with stored release info so zinit sees a "new" version
local plugin_dir="${ZINIT[PLUGINS_DIR]}/bat---extract-update"
echo "/fake/old/release" >! "$plugin_dir/._zinit/is_release"
# Remove extracted contents (keep ._zinit) to verify re-extraction
local f
for f in "$plugin_dir"/*(N); do
[[ "${f:t}" != "._zinit" ]] && command rm -rf "$f"
done
# Update — should re-download and extract the archive
run zinit update bat/extract-update
assert $state equals 0
assert $output does_not_contain 'ERROR'
assert $output does_not_contain "doesn't exist"
# Verify the binary was re-extracted and linked
assert "$bat" is_executable
run "$bat" --version; assert $state equals 0
}
#=============
# Flaky Tests
#=============
# @test 'atmos' { Universal Tool for DevOps and Cloud Automation (works with terraform, helm, helmfile, etc)
# skip 'null'
# run zinit for lbin'!* -> atmos' @cloudposse/atmos; assert $state equals 0
# local atmos="$ZBIN/atmos"; assert "$atmos" is_executable
# $atmos version; assert $state equals 0
# }
# @test 'bit' { A tool for composable software development
# skip 'skip bit test due to gh-r version bug'
# run zinit lbin'!bit* -> bit' for @teambit/bit; assert $state equals 0
# local bit="$ZBIN/bit"; assert "$bit" is_executable
# $bit --version; assert $state equals 0
# }
# @test 'neovim::appimage' { # Vim-fork focused on extensibility and usability
# skip 'null'
# run zinit bpick'*appimage*' id-as'neovim/appimage' for neovim/neovim
# assert $state equals 0; assert $output contains 'nvim.appimage'
# assert "$ZINIT[PLUGINS_DIR]/neovim---appimage/nvim.appimage" is_file
# }
# @test 'neovim::binary' { # Vim-fork focused on extensibility and usability
# skip 'null'
# run zinit lbin'!**/nvim' id-as'neovim/binary' for neovim/neovim; assert $state equals 0; assert $output does_not_contain 'appimage'
# local nvim="$ZBIN/nvim"; assert "$nvim" is_executable
# $nvim --version; assert $state equals 0
# }

View file

@ -1,67 +0,0 @@
#!/usr/bin/env zunit
# Tests for issue #728: Empty hook handlers cause "permission denied" errors
# https://github.com/zdharma-continuum/zinit/issues/728
@setup {
# Only the hook registries are needed. Do NOT re-source zinit.zsh here: the
# bootstrap has already sourced it from the sandbox clone, @setup bodies run
# under ERR_EXIT, and sourcing zinit.zsh trips it partway through, which
# aborts the setup and reports every test in this file as a failure with an
# empty message. Re-pointing ZINIT[BIN_DIR] at $PWD is likewise wrong -- it
# aims the tests at the real checkout instead of the sandbox. Neither test
# below calls a zinit function.
#
# HOME still has to point at the sandbox: the second test runs `zsh -c', which
# sources $HOME/.zshenv, so the developer's own rc file would otherwise leak
# into $output and $state.
HOME="$zi_test_dir"
typeset -gA ZINIT_EXTS ZINIT_EXTS2
}
@test 'empty hook handler error is prevented by fix' {
# This test verifies the fix for issue #728
# Without the fix, empty hook handlers cause "permission denied:" errors
# Register extension with empty handler (the exact pattern that triggers the bug)
ZINIT_EXTS["zinit hook:preinit-pre 10"]="10 z-annex-data: test-annex hook:preinit-pre '' '' ''"
# Test the hook processing logic directly
# This simulates what happens in .zinit-load at line 1648-1652
local output=""
local error_code=0
# Get the hook keys (simulating the reply array)
local -a test_keys
test_keys=( "zinit hook:preinit-pre 10" )
# Process hooks
for ___key in "${test_keys[@]}"; do
local -a ___arr
___arr=( "${(Q)${(z@)ZINIT_EXTS[$___key]:-$ZINIT_EXTS2[$___key]}[@]}" )
# With our fix, this checks if handler is non-empty before executing
if [[ -n "${___arr[5]:-}" ]]; then
output="would execute handler"
else
output="skipped empty handler"
fi
done
# Verify the fix prevented execution of empty handler
assert "$output" same_as "skipped empty handler"
}
@test 'direct test of empty command execution fails' {
# This demonstrates the underlying issue reported in #728
local empty_var=""
# Executing an empty variable causes "permission denied:"
run zsh -c 'empty_var=""; "${empty_var}"'
# Verify it fails with permission denied
assert $state equals 126 # 126 is the error code for permission denied
assert "$output" contains "permission denied:"
}
# vim:ft=zsh:sw=2:sts=2:et:foldmarker={,}:foldmethod=marker

View file

@ -1,288 +0,0 @@
#!/usr/bin/env zunit
# vim:ft=zsh:sw=2:sts=2:et:foldmarker={,}:foldmethod=marker
#
# Tests for ice value validation in .zinit-validate-ice()
#
@test 'as-valid-null' {
run zinit ice as'null'
assert $state equals 0
}
@test 'as-valid-command' {
run zinit ice as'command'
assert $state equals 0
}
@test 'as-valid-program' {
run zinit ice as'program'
assert $state equals 0
}
@test 'as-valid-completion' {
run zinit ice as'completion'
assert $state equals 0
}
@test 'as-empty' {
run zinit ice as''
assert $state equals 0
}
@test 'as-invalid-none' {
run zinit ice as'none'
assert $state equals 0
assert $output contains 'as'
assert $output contains 'none'
assert $output contains 'null'
assert $output contains 'program'
}
@test 'as-invalid-banana' {
run zinit ice as'banana'
assert $state equals 0
assert $output contains 'as'
assert $output contains 'banana'
}
@test 'wait-valid-0' {
run zinit ice wait'0'
assert $state equals 0
}
@test 'wait-valid-3' {
run zinit ice wait'3'
assert $state equals 0
}
@test 'wait-valid-0a' {
run zinit ice wait'0a'
assert $state equals 0
}
@test 'wait-valid-3b' {
run zinit ice wait'3b'
assert $state equals 0
}
@test 'wait-valid-1c' {
run zinit ice wait'1c'
assert $state equals 0
}
@test 'wait-valid-bang' {
run zinit ice wait'!0'
assert $state equals 0
}
@test 'wait-valid-bang-a' {
run zinit ice wait'!2a'
assert $state equals 0
}
@test 'wait-valid-bang-no-suffix' {
run zinit ice wait'!3'
assert $state equals 0
}
@test 'wait-valid-decimal' {
run zinit ice wait'3.5'
assert $state equals 0
}
@test 'wait-empty' {
run zinit ice wait
assert $state equals 0
}
@test 'wait-cond-command-exists' {
run zinit ice wait'[[ -n $commands[fzf] ]]'
assert $state equals 0
}
@test 'wait-cond-arithmetic' {
run zinit ice wait'(( $+commands[kubectl] ))'
assert $state equals 0
}
@test 'wait-cond-variable' {
run zinit ice wait'[[ -n $MY_VAR ]]'
assert $state equals 0
}
@test 'wait-cond-always-false' {
run zinit ice wait'[[ 1 = 0 ]]'
assert $state equals 0
}
@test 'wait-cond-single-command' {
run zinit ice wait'type fzf &>/dev/null'
assert $state equals 0
}
@test 'wait-invalid-suffix-x' {
run zinit ice wait'0x'
assert $state equals 0
assert $output contains 'wait'
assert $output contains 'x'
# +zi-log colourises each suffix letter separately, so the list reads
# `a<esc>, <esc>b<esc>, <esc>c' in the raw output and no contiguous
# 'a, b, c' exists to match. Strip the escapes before asserting on the
# sentence as a whole.
setopt localoptions extendedglob
local plain="${(S)output//$'\e'\[[0-9;]#[a-zA-Z]/}"
assert "$plain" contains 'Expected one of: a, b, c'
}
@test 'wait-invalid-suffix-d' {
run zinit ice wait'3d'
assert $state equals 0
assert $output contains 'wait'
assert $output contains 'd'
}
@test 'wait-invalid-suffix-z' {
run zinit ice wait'1z'
assert $state equals 0
assert $output contains 'wait'
assert $output contains 'z'
}
@test 'wait-invalid-bang-suffix' {
run zinit ice wait'!2x'
assert $state equals 0
assert $output contains 'wait'
assert $output contains 'x'
}
@test 'wait-invalid-suffix-A' {
run zinit ice wait'0A'
assert $state equals 0
assert $output contains 'wait'
assert $output contains 'A'
}
@test 'depth-valid-1' {
run zinit ice depth'1'
assert $state equals 0
}
@test 'depth-valid-10' {
run zinit ice depth'10'
assert $state equals 0
}
@test 'depth-invalid-zero' {
run zinit ice depth'0'
assert $state equals 0
assert $output contains 'depth'
assert $output contains '0'
}
@test 'depth-empty' {
run zinit ice depth''
assert $state equals 0
}
@test 'depth-invalid-text' {
run zinit ice depth'abc'
assert $state equals 0
assert $output contains 'depth'
assert $output contains 'abc'
}
@test 'depth-invalid-negative' {
run zinit ice depth'-1'
assert $state equals 0
assert $output contains 'depth'
assert $output contains '-1'
}
@test 'depth-invalid-decimal' {
run zinit ice depth'1.5'
assert $state equals 0
assert $output contains 'depth'
assert $output contains '1.5'
}
@test 'combined-all-valid' {
run zinit ice as'null' wait'0a' depth'1'
assert $state equals 0
}
@test 'combined-some-invalid' {
run zinit ice as'none' wait'0a'
assert $state equals 0
assert $output contains 'as'
assert $output contains 'none'
}
@test 'combined-all-invalid' {
run zinit ice as'none' wait'3x' depth'abc'
assert $state equals 0
assert $output contains 'as'
assert $output contains 'wait'
assert $output contains 'depth'
}
@test 'dash-prefix-valid' {
run zinit ice --as'null'
assert $state equals 0
}
@test 'dash-prefix-invalid' {
run zinit ice --as'none'
assert $state equals 0
assert $output contains 'as'
assert $output contains 'none'
}
@test 'as-invalid-NULL-case' {
run zinit ice as'NULL'
assert $state equals 0
assert $output contains 'as'
assert $output contains 'NULL'
}
@test 'as-colon-valid' {
run zinit ice as:null
assert $state equals 0
}
@test 'as-colon-invalid' {
run zinit ice as:none
assert $state equals 0
assert $output contains 'as'
assert $output contains 'none'
}
@test 'for-invalid-as' {
# nocompile keeps the assertion on ice validation. Without it the load
# reaches ∞zinit-compile-plugin-hook, which returns 1 on this fixture
# ("No files for compilation found") and makes `zinit for' exit 1 for a
# reason that has nothing to do with the invalid ice under test.
run zinit for as'none' nocompile @zdharma-continuum/null
assert $state equals 0
assert $output contains 'as'
assert $output contains 'none'
}

View file

@ -1,338 +0,0 @@
#!/usr/bin/env zunit
@setup {
ZPLUGINS=$ZINIT[PLUGINS_DIR]
function _zunit_assert_not_executable(){
local pathname=$1 filepath
# If filepath is relative, prepend the test directory
if [[ "${pathname:0:1}" != "/" ]]; then
filepath="$testdir/${pathname}"
else
filepath="$pathname"
fi
[[ ! -x "$filepath" ]] && return 0
echo "'$pathname' is executable but should not be"
exit 1
}
function _zunit_assert_not_exists(){
local file_path=$1
if [[ "${file_path:0:1}" != "/" ]]; then # relative path - prepend the test directory
filepath="${testdir}/${file_path}"
fi
[[ ! -e "$file_path" ]] && return 0
exit "found '${file_path}'"
}
# Loads $1 once so it is already cloned, then cds so that $OLDPWD is a known
# directory of our own making, reported in $oldpwd_away. Deliberately not
# returning it via $(...): that forks a subshell, which would discard the cd.
function _oldpwd_fixture() {
local id="$1"
typeset -g oldpwd_away="$zi_test_dir/away-${id//\//-}"
zinit as"null" id-as"$id" for zdharma-continuum/null || true
command mkdir -p "$oldpwd_away"
builtin cd -q "$oldpwd_away"
builtin cd -q "$zi_test_dir"
}
# $1 - the $PWD to expect; $2 - where `cd -' must land, which also proves
# $OLDPWD. `equals' is arithmetic in zunit, so paths need `same_as'.
function _assert_dirs_restored() {
assert "$PWD" same_as "$1"
assert "$OLDPWD" same_as "$2"
builtin cd - >/dev/null 2>&1 || true
assert "$PWD" same_as "$2"
}
}
@test 'mv' {
run zinit as"null" id-as"test/mv" mv"readme.md -> mv.md" for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---mv/mv.md" is_file
assert "$ZPLUGINS/test---mv/mv.md" is_readable
assert "$ZPLUGINS/test---mv/readme.md" not_exists
}
@test 'cp' {
run zinit as"null" id-as"test/cp" cp"readme.md -> cp.md" for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---cp/cp.md" is_file
assert "$ZPLUGINS/test---cp/cp.md" is_readable
assert "$ZPLUGINS/test---cp/readme.md" is_file
}
@test 'atclone' {
run zinit as"null" id-as"test/atclone" atclone"mv readme.md atclone.md" for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---atclone/atclone.md" is_file
assert "$ZPLUGINS/test---atclone/atclone.md" is_readable
assert "$ZPLUGINS/test---atclone/readme.md" not_exists
}
@test 'make' {
run zinit as"null" id-as"test/make" atclone"printf 'all:\n\ttouch whatever\n' > Makefile" make"all" for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---make/whatever" is_file
}
@test 'completions' {
run zinit as"null" id-as"test/completions" atclone"touch _whatever" completions for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---completions/_whatever" is_file
assert "$ZINIT[COMPLETIONS_DIR]/_whatever" is_file
}
@test 'completions-overwrite' {
# if both are given, the completions wins
run zinit as"null" id-as"test/completions-overwrite" atclone"touch _whatever2" nocompletions completions for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---completions-overwrite/_whatever2" is_file
assert "$ZINIT[COMPLETIONS_DIR]/_whatever2" is_file
}
@test 'completions-ignored' {
# only the _valid file should be installed as a completion
run zinit as"null" id-as"test/ignored_completions" atclone"touch __init__.py _valid" completions for zdharma-continuum/null
assert $state equals 0
assert "$ZPLUGINS/test---ignored_completions/_valid" is_file
assert "$ZPLUGINS/test---ignored_completions/__init__.py" is_file
assert "$ZINIT[COMPLETIONS_DIR]/_valid" is_file
# Basenames, and `not_in' for a flat array: `is_not_value_in' builds a hash,
# so it dies on an odd element count and never matches a bare name anyway.
local -a comps=( "$ZINIT[COMPLETIONS_DIR]"/_*(N:t) )
assert __init__.py not_in $comps
}
@test 'ziextract error on missing file' {
run ziextract /tmp/zi-nonexistent-file.zip
assert $state equals 1
assert $output contains 'ERROR'
assert $output contains "doesn't exist"
}
@test 'ziextract plain single file (not an archive)' {
# A bare gh-r-style release binary: no "unrecognized archive" error,
# the file is kept as-is and marked executable.
local workdir=$(mktemp -d)
printf '#!/bin/sh\necho jq\n' > "$workdir/jq-macos-arm64"
_zi_extract_plain() { cd "$workdir" && ziextract jq-macos-arm64 }
run _zi_extract_plain
assert $state equals 0
assert $output does_not_contain "didn't recognize archive type"
assert $output contains 'not an archive'
assert "$workdir/jq-macos-arm64" is_executable
rm -rf "$workdir"
}
@test 'gh-r appimage: bpick + mv on non-archive asset' {
# Real-world recipe for the ziextract non-archive fallback: the AppImage is not
# an archive, must be kept, marked executable, and renamed by the mv ice.
run zinit as"program" from"gh-r" bpick"*AppImage" mv"gh* -> ghostty" id-as"test/ghostty" for pkgforge-dev/ghostty-appimage
assert $state equals 0
assert $output does_not_contain 'ERROR'
assert $output does_not_contain "didn't recognize archive type"
assert "$ZPLUGINS/test---ghostty/ghostty" is_file
assert "$ZPLUGINS/test---ghostty/ghostty" is_executable
local -a leftovers=( "$ZPLUGINS"/test---ghostty/*.appimage(N) )
assert $#leftovers equals 0
}
@test 'ziextract still errors on unrecognized explicit type' {
local workdir=$(mktemp -d)
printf 'plain text\n' > "$workdir/somefile"
_zi_extract_bogus() { cd "$workdir" && ziextract somefile bogus-type }
run _zi_extract_bogus
assert $output contains "didn't recognize archive type"
rm -rf "$workdir"
}
@test 'ziextract plain (no flattening)' {
# extract'' → ziextract with no flags: directory structure is preserved
local workdir=$(mktemp -d)
mkdir "$workdir/subdir"
printf 'hello\n' > "$workdir/subdir/file1.txt"
( cd "$workdir" && zip -qr test.zip subdir/ )
( cd "$workdir" && ziextract test.zip )
assert "$workdir/subdir/file1.txt" is_file
assert "$workdir/file1.txt" not_exists
rm -rf "$workdir"
}
@test 'ziextract --move (flatten one level)' {
# extract'!' → ziextract --move: outer/file.txt → file.txt at root
local workdir=$(mktemp -d)
mkdir "$workdir/outer"
printf 'hello\n' > "$workdir/outer/file1.txt"
printf 'world\n' > "$workdir/outer/file2.txt"
( cd "$workdir" && zip -qr test.zip outer/ )
( cd "$workdir" && ziextract test.zip --move )
assert "$workdir/file1.txt" is_file
assert "$workdir/file2.txt" is_file
assert "$workdir/outer" not_exists
rm -rf "$workdir"
}
@test 'ziextract --move2 (flatten two levels)' {
# extract'!!' → ziextract --move --move2: outer/inner/file.txt → file.txt at root
local workdir=$(mktemp -d)
mkdir -p "$workdir/outer/inner"
printf 'hello\n' > "$workdir/outer/inner/file1.txt"
( cd "$workdir" && zip -qr test.zip outer/ )
( cd "$workdir" && ziextract test.zip --move --move2 )
assert "$workdir/file1.txt" is_file
assert "$workdir/outer" not_exists
rm -rf "$workdir"
}
@test 'ziextract deletes archive by default' {
local workdir=$(mktemp -d)
( cd "$workdir" && printf 'hello\n' > file1.txt && zip -q test.zip file1.txt && rm file1.txt )
( cd "$workdir" && ziextract test.zip )
assert "$workdir/file1.txt" is_file
assert "$workdir/test.zip" not_exists
rm -rf "$workdir"
}
@test 'ziextract --norm keeps archive after extraction' {
# extract'-' → ziextract --norm: archive is preserved after extraction
local workdir=$(mktemp -d)
( cd "$workdir" && printf 'hello\n' > file1.txt && zip -q test.zip file1.txt && rm file1.txt )
( cd "$workdir" && ziextract test.zip --norm )
assert "$workdir/file1.txt" is_file
assert "$workdir/test.zip" is_file
rm -rf "$workdir"
}
@test 'ziextract-permissions' {
# Build a zip with known permissions, call ziextract directly, and verify
# that only files with +x in the archive come out executable.
local srcdir workdir
srcdir=$(mktemp -d)
workdir=$(mktemp -d)
# run_me.sh: +x in archive, has shebang → must be executable
printf '#!/bin/sh\necho run\n' > "$srcdir/run_me.sh"
chmod +x "$srcdir/run_me.sh"
# also_run.py: no +x in archive, has shebang → must NOT be executable (shebang alone is not enough)
printf '#!/usr/bin/env python3\nprint("hi")\n' > "$srcdir/also_run.py"
# library.py: no +x, no shebang → must NOT be executable
printf 'def foo(): pass\n' > "$srcdir/library.py"
# pre_marked.sh: +x in archive, no shebang → must be executable (archive bit)
printf 'echo pre\n' > "$srcdir/pre_marked.sh"
chmod +x "$srcdir/pre_marked.sh"
# Build zip preserving permissions, then extract via ziextract
( cd "$srcdir" && zip -q "$workdir/test.zip" run_me.sh also_run.py library.py pre_marked.sh )
(( ${+functions[ziextract]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh"
( builtin cd "$workdir" && ziextract test.zip )
assert "$workdir/run_me.sh" is_executable
assert "$workdir/pre_marked.sh" is_executable
assert "$workdir/also_run.py" not_executable
assert "$workdir/library.py" not_executable
rm -rf "$srcdir" "$workdir"
}
# $OLDPWD regression coverage. See the block comment on .zinit-restore-dir in
# zinit.zsh: zinit cds into the plugin directory to run atinit/atload/multisrc,
# and the cd back used to restore $PWD but leave $OLDPWD -- and zsh's internal
# `cd -' target -- pointing at the plugin directory.
@test 'atload does not leak $OLDPWD' {
_oldpwd_fixture test/oldpwd-atload
zinit as"null" id-as"test/oldpwd-atload" atload"true" for zdharma-continuum/null || true
_assert_dirs_restored "$zi_test_dir" "$oldpwd_away"
}
@test 'atinit does not leak $OLDPWD' {
_oldpwd_fixture test/oldpwd-atinit
zinit as"null" id-as"test/oldpwd-atinit" atinit"true" for zdharma-continuum/null || true
_assert_dirs_restored "$zi_test_dir" "$oldpwd_away"
}
@test 'multisrc does not leak $OLDPWD' {
_oldpwd_fixture test/oldpwd-multisrc
# multisrc evaluates its value with the plugin directory as cwd, so give it
# a real file to find there.
builtin print -r -- 'true' >! "$ZPLUGINS/test---oldpwd-multisrc/extra.zsh"
zinit as"null" id-as"test/oldpwd-multisrc" multisrc"extra.zsh" for zdharma-continuum/null || true
_assert_dirs_restored "$zi_test_dir" "$oldpwd_away"
}
@test 'nocd ice leaves $OLDPWD untouched' {
# nocd suppresses the cd into the plugin directory, so the restore must not
# run either. It used to run unconditionally, and its no-op cd back to $PWD
# still set OLDPWD=$PWD -- turning the user's `cd -' into a dead no-op.
_oldpwd_fixture test/oldpwd-nocd
zinit as"null" id-as"test/oldpwd-nocd" atload"true" nocd for zdharma-continuum/null || true
_assert_dirs_restored "$zi_test_dir" "$oldpwd_away"
}
@test 'nocd ice still restores a cwd the ice body moved' {
# nocd only suppresses zinit's own cd into the plugin directory. An ice body
# that cds on its own must still be undone, or the ice strands the user's
# shell wherever the plugin decided to go.
_oldpwd_fixture test/oldpwd-nocd-moved
local elsewhere="$zi_test_dir/elsewhere-nocd"
command mkdir -p "$elsewhere"
zinit as"null" id-as"test/oldpwd-nocd-moved" nocd \
atload"builtin cd -q $elsewhere" for zdharma-continuum/null || true
_assert_dirs_restored "$zi_test_dir" "$oldpwd_away"
}
@test 'atload survives a since-deleted $OLDPWD' {
# Restoring by bouncing through the original $OLDPWD must not blow up when
# that directory is gone: no error on stderr, and no leak of the plugin dir.
local home="$zi_test_dir" stale="$zi_test_dir/stale-oldpwd"
zinit as"null" id-as"test/oldpwd-stale" for zdharma-continuum/null || true
command mkdir -p "$stale"
builtin cd -q "$stale"
builtin cd -q "$home"
command rmdir "$stale"
local errfile="$zi_test_dir/oldpwd-stale.err"
zinit as"null" id-as"test/oldpwd-stale" atload"true" for zdharma-continuum/null \
2>"$errfile" || true
assert "$(<$errfile)" does_not_contain "no such file or directory"
# $OLDPWD cannot be honoured, so `cd -' must degrade to a harmless no-op
# rather than navigating into the plugin directory.
_assert_dirs_restored "$home" "$home"
}
@test 'atload leaves a usable $OLDPWD when it started unset' {
local home="$zi_test_dir"
zinit as"null" id-as"test/oldpwd-unset" for zdharma-continuum/null || true
builtin cd -q "$home"
unset OLDPWD
zinit as"null" id-as"test/oldpwd-unset" atload"true" for zdharma-continuum/null || true
# A fresh zsh sets OLDPWD to PWD, which makes `cd -' a no-op. Match that.
_assert_dirs_restored "$home" "$home"
}
@test 'configure hook restores the current directory' {
# ∞zinit-configure-base-hook cds into the plugin directory inside a plain
# { } block -- not a subshell -- and every return path used to leave the
# shell parked there. A directory that already has a Makefile takes the
# earliest of those return paths.
(( ${+functions[∞zinit-configure-base-hook]} )) || \
builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh"
local home="$zi_test_dir" away="$zi_test_dir/away-configure"
local dir="$zi_test_dir/configure-plugin"
command mkdir -p "$away" "$dir"
builtin print -r -- 'all:' >! "$dir/Makefile"
builtin cd -q "$away"
builtin cd -q "$home"
# zsh's dynamic scoping makes this ICE visible to the hook we call, without
# disturbing the global one.
local -A ICE=( configure '' )
∞zinit-configure-base-hook snippet '' '' "$dir" '' '' '' || true
_assert_dirs_restored "$home" "$away"
}
# vim:ft=zsh:sw=2:sts=2:et:foldmarker=\ {,}:foldmethod=marker

View file

@ -1,125 +0,0 @@
#!/usr/bin/env zunit
@setup {
HOME="$zi_test_dir"
typeset -gx ZBIN="$zi_test_dir/polaris/bin"
}
# @test 'cmatrix' {
# run zinit build for @abishekvashok/cmatrix;
# local cmatrix="$ZBIN/cmatrix"; assert "$cmatrix" is_executable
# run "$cmatrix" -V; assert $state equals 0
# # ensure cmake artifacts are deleted
# zinit delete --yes abishekvashok/cmatrix; assert $state equals 0
# run "$cmatrix"; assert $state equals 127
# }
@test 'figlet' {
run zinit make for @cmatsuoka/figlet; assert $state equals 0
local figlet="$ZBIN/figlet"; assert "$figlet" is_executable
run "$figlet" -I 1; assert $state equals 0
}
@test 'htop' {
run zinit build for @htop-dev/htop; assert $state equals 0
local htop="$ZBIN/htop"; assert "$htop" is_executable
run "$htop" --version; assert $state equals 0
}
@test 'bash' {
run zinit build for @tianon/mirror-bash; assert $state equals 0
local bash="$ZBIN/bash"; assert $bash is_executable
run "$bash" --version; assert $state equals 0
}
@test 'ctags' {
run zinit build for @universal-ctags/ctags; assert $state equals 0
local ctags="$ZBIN/ctags"; assert "$ctags" is_executable
run "$ctags" --version; assert $state equals 0
}
@test 'lua-format' {
run zinit cmake for @Koihik/LuaFormatter; assert $state equals 0
local lua_format="$ZBIN/lua-format"; assert "$lua_format" is_executable
run "$lua_format" --version; assert $state equals 0
run zinit delete --yes Koihik/LuaFormatter; assert $state equals 0
run "$lua_format" --version; assert $state equals 127
}
@test 'jq' {
run zinit build for @jqlang/jq; assert $state equals 0
local jq="$ZBIN/jq"; assert "$jq" is_executable
run "$jq" --version; assert $state equals 0
}
@test 'ncurses' {
run zinit configure'--enable-widec --enable-termcap' make for @mirror/ncurses; assert $state equals 0
local ncurses="$ZBIN/clear"; assert "$ncurses" is_executable
run "$ncurses" -V; assert $state equals 0
run zinit delete --yes mirror/ncurses; assert $state equals 0
run "$ncurses" -V; assert $state equals 127
}
@test 'neofetch' {
run zinit make for @dylanaraps/neofetch; assert $state equals 0
local neofetch="$ZBIN/neofetch"; assert "$neofetch" is_executable
run "$neofetch" --version; assert $state equals 1; assert $output contains 'Neofetch'
}
@test 'neovim-make' {
run zinit make for @neovim/neovim; assert $state equals 0
local neovim="$ZBIN/nvim"; assert $neovim is_executable
run "$neovim" --version; assert $state equals 0
nvim_ver="$($neovim --version | head -n1 | awk '{print $2}')";
nvim_commit="$(git --work-tree=$ZINIT[PLUGINS_DIR]/neovim---neovim rev-parse --short HEAD)";
print -lPr " " "nvim ver: %F{blue}$nvim_ver%f" "nvim commit sha: %F{blue}$nvim_commit%f" "check: [[ %F{blue}$nvim_ver%f = %F{blue}*$nvim_commit(#e)%f ]]"
[[ $nvim_ver = *$nvim_commit(#e) ]] && print -P "%F{green}ok%f"
run zinit delete --yes neovim/neovim; assert $state equals 0
run "$neovim" --version; assert $state equals 127
}
# @test 'neovim-cmake' {
# run zinit cmake for @neovim/neovim; assert $state equals 0
# local neovim="$ZBIN/nvim"; assert $neovim is_executable
# run "$neovim" --version; assert $state equals 0
#
# nvim_ver="$($neovim --version | head -n1 | awk '{print $2}')";
# nvim_commit="$(git --work-tree=$ZINIT[PLUGINS_DIR]/neovim---neovim rev-parse --short HEAD)";
# print -lPr " " "nvim ver: %F{blue}$nvim_ver%f" "nvim commit sha: %F{blue}$nvim_commit%f" "check: [[ %F{blue}$nvim_ver%f = %F{blue}*$nvim_commit(#e)%f ]]"
# [[ $nvim_ver = *$nvim_commit(#e) ]] && print -P "%F{green}ok%f"
#
# run zinit delete --yes neovim/neovim; assert $state equals 0
# }
@test 'tmux' {
if [[ $OSTYPE =~ 'darwin*' ]]; then
run zinit configure'--disable-utf8proc' make for @tmux/tmux; assert $state equals 0
else
run zinit build for @tmux/tmux; assert $state equals 0
fi
local tmux="$ZBIN/tmux"; assert $tmux is_executable
run "$tmux" -V; assert $state equals 0
run zinit delete --yes tmux/tmux; assert $state equals 0
run "$tmux" -V; assert $state equals 127
}
@test 'vim' {
run zinit build for @vim/vim; assert $state equals 0
local vim="$ZBIN/vim"; assert $vim is_executable
run "$vim" --version; assert $state equals 0
# run zinit delete --yes vim/vim; assert $state equals 0
}
@test 'zsh' {
# run zinit configure'--with-tcsetpgrp' make'install.bin' for @zsh-users/zsh; assert $state equals 0
run zinit configure'--with-tcsetpgrp' atclone"./Util/preconfig" make'install.bin' for @zsh-users/zsh; assert $state equals 0
local zsh="$ZBIN/zsh"; assert $zsh is_executable
run "$zsh" --version; assert $state equals 0
run zinit delete --yes zsh-users/zsh; assert $state equals 0
run "$zsh" --version; assert $state equals 127
}
# ===========
# Flaky tests
# ===========
# @test 'stow' {
# run zinit configure'--without-pmdir' make for @aspiers/stow; assert $state equals 0
# local stow="$ZBIN/stow"; assert "$stow" is_executable
# run "$stow" --version; assert $state equals 0
# }
# @test 'zsh-completions' {
# run zinit light-mode for zsh-users/zsh-completions
# zinit cd zsh-users/zsh-completions
# run zinit creinstall -q .; assert $state equals 0
# local broken_completions=($(echo "$ZINIT[COMPLETIONS_DIR]"/*(-@N))); assert "$#broken_completions[@]" equals 0
# }
# vim:ft=zsh:sw=2:sts=2:et:foldmarker={,}:foldmethod=indent

View file

@ -1,84 +0,0 @@
#!/usr/bin/env zunit
@setup {
GH_RAW_URL='https://raw.githubusercontent.com'
setup_snippet_ok() { # state=$1, output=$2, file=$3
assert $1 equals 0
assert $2 contains "Setting up snippet"
assert $3 is_file; assert $3 is_readable
}
install_completion(){
zinit for as'completion' nocompile id-as"$1" is-snippet "$GH_RAW_URL/$2"
}
}
@test 'OMZL::spectrum.zsh' {
run zinit snippet OMZL::spectrum.zsh
setup_snippet_ok $state $output "$ZINIT[SNIPPETS_DIR]/OMZL::spectrum.zsh/OMZL::spectrum.zsh"
}
@test 'OMZP::git' {
run zinit snippet OMZP::git
setup_snippet_ok $state $output "$ZINIT[SNIPPETS_DIR]/OMZP::git/OMZP::git"
}
@test 'PZTM::environment' {
run zinit snippet PZTM::environment
setup_snippet_ok $state $output "$ZINIT[SNIPPETS_DIR]/PZTM::environment/PZTM::environment"
}
@test 'bat-completion' {
run install_completion 'bat-completion/_bat' 'sharkdp/bat/master/assets/completions/bat.zsh.in'
setup_snippet_ok $state $output "$ZINIT[COMPLETIONS_DIR]"/_bat
}
@test 'brew-completion' {
run install_completion 'brew-completion/_brew' 'Homebrew/brew/master/completions/zsh/_brew'
setup_snippet_ok $state $output "$ZINIT[COMPLETIONS_DIR]"/_brew
}
@test 'docker-completion' {
run install_completion 'docker-completion/_docker' 'docker/cli/master/contrib/completion/zsh/_docker'
setup_snippet_ok $state $output "$ZINIT[COMPLETIONS_DIR]"/_docker
}
@test 'exa-completion' {
run install_completion 'exa-completion/_exa' 'ogham/exa/master/completions/zsh/_exa'
setup_snippet_ok $state $output "$ZINIT[COMPLETIONS_DIR]"/_exa
}
@test 'fd-completion' {
run install_completion 'fd-completion/_fd' 'sharkdp/fd/master/contrib/completion/_fd'
setup_snippet_ok $state $output "$ZINIT[COMPLETIONS_DIR]"/_fd
}
@test 'tldr-completion::snippet' {
run install_completion 'tldr-completion/_tldr' 'tealdeer-rs/tealdeer/main/completion/zsh_tealdeer'
setup_snippet_ok $state $output "$ZINIT[COMPLETIONS_DIR]"/_tldr
zinit delete --yes tldr-completion/_tldr; zinit cclear
}
@test 'tldr-completion::gh-r' {
artifact="$ZINIT[PLUGINS_DIR]/tldr-completion---gh-r"
run zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" mv"completions_zsh -> _tldr_ghr" pick"_tldr_ghr" @tealdeer-rs/tealdeer
assert $state equals 0
assert "$artifact/_tldr_ghr" is_file
assert $artifact/_tldr_ghr is_readable
assert "$ZINIT[COMPLETIONS_DIR]"/_tldr_ghr is_file
assert "$ZINIT[COMPLETIONS_DIR]"/_tldr_ghr is_readable
}
@test 'zinit local snippet symlink' {
mkdir -p "${ZINIT[HOME_DIR]}/external"
local actual="${ZINIT[HOME_DIR]}/external/mysnippet.zsh"
cat<<EOF >$actual
alias foo=date
EOF
run zinit is-snippet link nocompile id-as'mysnippet' for $actual
assert $state equals 0
assert "$output" contains "Setting up snippet"
assert "$output" contains "Linking"
local artifact="${ZINIT[SNIPPETS_DIR]}/mysnippet/mysnippet"
assert $artifact is_link
assert $artifact is_readable
local link="$(readlink "$artifact")"
local target="$(cd ${artifact:h}; cd ${link:h}; pwd)/${link:t}"
assert $target same_as $actual
}
# vim:ft=zsh:sw=2:sts=2:et:foldmarker=@test,}:foldmethod=marker

View file

@ -1,504 +0,0 @@
#!/bin/zsh
# This is a Zle widget file. In general, it is s used as (without setup
# provided by the plugin):
#
# autoload browse-symbol
# zle -N browse-symbol
# zle -N browse-symbol-backwards browse-symbol
# zle -N browse-symbol-pbackwards browse-symbol
# zle -N browse-symbol-pforwards browse-symbol
# bindkey "^T" browse-symbol
#
# This will bind to Ctrl-T. The plugin binds to Ctrl-O Ctrl-K.
#
# Example zstyles:
# zstyle ":plugin:zinit:symbol-search" page-size 5
# zstyle ":plugin:zinit:symbol-search" highlight-color "fg=magenta,bold"
# zstyle ":plugin:zinit:symbol-search" heading-color "fg=18,bold"
# zstyle ":plugin:zinit:symbol-search" title-color "fg=180,bold"
# zstyle ":plugin:zinit:symbol-search" arrow-color "fg=180,bg=39,bold"
# zstyle ":plugin:zinit:symbol-search" func-color "fg=208,bold"
# zstyle ":plugin:zinit:symbol-search" var-color "fg=174,bg=39,bold"
# zstyle ":plugin:zinit:symbol-search" macro-color "fg=39,bold"
# zstyle ":plugin:zinit:symbol-search" eqdol-color "fg=183,bg=39,bold"
emulate -L zsh
setopt typesetsilent extendedglob noshortloops localtraps warncreateglobal
# When an error, then no cursor keys bindings
zmodload zsh/terminfo 2>/dev/null
zmodload zsh/termcap 2>/dev/null
typeset -gA TAG
integer -g __tfind_spe_index
integer -g __tfind_spe_restart __tfind_spe_call_count __tfind_spe_funct __tfind_spe_sort
typeset -g __tfind_page_size __tfind_high_color __tfind_heading_color \
__tfind_title_color __tfind_arrow_color __tfind_func_color \
__tfind_var_color __tfind_eqdol_color __tfind_macro_color
typeset -gaU __tfind_spe_found
typeset -ga __tfind_tag_data
typeset -g __tfind_git_or_project __tfind_outside_git
local mbegin mend match
local MATCH
integer MBEGIN MEND
(( __tfind_spe_call_count ++ ))
trap '(( __tfind_spe_call_count -- )); return 0;' INT
_tfind_find_index() {
local q
local -a p
# Read tags file
p=( (../)#TAGS(N) )
TAG[file]=${${(On)p}[1]}
[[ -f ./TAGS ]] && TAG[file]=$PWD/TAGS
if [[ -n $TAG[file] ]]; then
TAG[git-or-project]=${${TAG[file]:a}:h:t}
else
TAG[git-or-project]="<unknown>"
#TAG[file]=
fi
# Pre-process found index
TAG[file-pp]=${TAG[file]/TAGS/.TAGS}.z
if [[ -n $TAG[file] && -f $TAG[file] && ( ! -f $TAG[file-pp] || $TAG[file] -nt $TAG[file-pp]) ]]
then
local sed_
(( $+commands[sed] )) && sed_=sed
(( $+commands[gsed] )) && sed_=gsed
# Generate simplified file append the filename at each line,
# so that it's not only at the preamble line
command $sed_ -r -n $'/^\x0c$/ { n; s/,[^,]*$//;s/^/\x02/; h; d;}; G; y/\\n/,/; p' $TAG[file] >! $TAG[file-pp]
fi
# Read index, and as index is found, establish git main dir for it
__tfind_outside_git=$TAG[file]:h
if [[ -n $TAG[file] && -f $TAG[file-pp] ]]; then
__tfind_tag_data=( ${"${(@f)"$(<${TAG[file-pp]})"}"##[[:space:]]##} )
# Cleanup functions and their preambles
__tfind_tag_data=( ${__tfind_tag_data[@]/(#b)(\([^\)]#\))[[:space:]]#[\{]*($'\x7f')/$match[1]$match[2]} )
__tfind_tag_data=( ${__tfind_tag_data[@]/(#b)[[:space:]]\#*($'\x7f')/$match[1]} )
__tfind_outside_git="${PWD%/${$(git rev-parse --quiet --show-prefix 2>/dev/null)%/}}"
if [[ -d $__tfind_outside_git && -n ${${(M)PWD##$__tfind_outside_git}##$HOME} ]]; then
TAG[git-or-project]=$__tfind_outside_git:t
TAG[repo-dir]=$__tfind_outside_git
else
TAG[git-or-project]=$TAG[file]:h
TAG[repo-dir]=$TAG[file]:h
fi
return 0
fi
return 1
}
_tfind_error_msg()
{
integer buflen=$#BUFFER
if [[ -z $TAG[repo-dir] || $TAG[repo-dir] == . ]]; then
POSTDISPLAY=$'\n'"Symbol index NOT found, NO DATA to show, sleeping…"
local search_buffer=
elif [[ $#__tfind_tag_data -eq 0 ]]; then
POSTDISPLAY=$'\n'"The index file contains NO symbol data, forced sleeping..."
local search_buffer=
elif [[ $#__tfind_spe_found -eq 0 && $search_buffer == [[:space:]]# ]]; then
POSTDISPLAY=$'\n'"No items found"
elif [[ $search_buffer != [[:space:]]# && $#__tfind_spe_found -eq 0 ]]; then
POSTDISPLAY=$'\n'"Found 0 matches for query: $search_buffer"
else
return 1
fi
region_highlight+=("$buflen $(( $buflen+$#POSTDISPLAY-$#search_buffer )) fg=179,bold")
region_highlight+=("$(( $buflen+$#POSTDISPLAY-$#search_buffer )) $(( $buflen+$#POSTDISPLAY )) fg=39,bold")
# Number?
[[ -n ${#${(MS)POSTDISPLAY##<->##}} ]] && \
region_highlight+=("$((buflen+7)) $((buflen+7+${#${(MS)POSTDISPLAY##<->##}})) fg=39,bold")
return 0
}
_tfind_main() {
local match mbegin mend
local MATCH
integer MBEGIN MEND buflen=${#BUFFER}
TAG[fun-xt-chars]='+.:@\/→↓←↑\$,_\--'
# First call or restart?
if [[ $__tfind_spe_call_count -le 1 || $__tfind_spe_restart = 1 ]]; then
if [[ $__tfind_spe_call_count -le 1 ]]; then
# Read configuration data
zstyle -s ":plugin:zinit:symbol-search" page-size __tfind_page_size || __tfind_page_size=$(( LINES / 3 ))
zstyle -s ":plugin:zinit:symbol-search" highlight-color __tfind_high_color || __tfind_high_color="fg=39,bold"
zstyle -s ":plugin:zinit:symbol-search" heading-color __tfind_heading_color || __tfind_heading_color="fg=69,bold"
zstyle -s ":plugin:zinit:symbol-search" title-color __tfind_title_color || __tfind_title_color="fg=208,bold"
zstyle -s ":plugin:zinit:symbol-search" arrow-color __tfind_arrow_color || __tfind_arrow_color="fg=227,bg=69,bold"
zstyle -s ":plugin:zini t:symbol-search" var-color __tfind_var_color || __tfind_var_color="fg=127,bold"
zstyle -s ":plugin:zinit:symbol-search" func-color __tfind_func_color || __tfind_func_color="fg=70,bold"
zstyle -s ":plugin:zinit:symbol-search" macro-color __tfind_macro_color || __tfind_macro_color="fg=208,bold"
zstyle -s ":plugin:zinit:symbol-search" eqdol-color __tfind_eqdol_color || __tfind_eqdol_color="fg=69,bold"
# Find the index to operate on, git dir, etc.
_tfind_find_index || { _tfind_error_msg && return;}
fi
# '0' will get changed into $to_display limit
[[ $WIDGET = *-symbol || $WIDGET = *-pforwards ]] && __tfind_spe_index=1
[[ $WIDGET = *-backwards || $WIDGET = *-pbackwards ]] && __tfind_spe_index=0
__tfind_spe_found=()
__tfind_spe_restart=0
else
# Consecutive call
[[ $WIDGET = *-symbol ]] && (( __tfind_spe_index ++ ))
[[ $WIDGET = *-backwards ]] && (( __tfind_spe_index -- ))
[[ $WIDGET = *-pforwards ]] && (( __tfind_spe_index = __tfind_spe_index + __tfind_page_size ))
[[ $WIDGET = *-pbackwards ]] && (( __tfind_spe_index = __tfind_spe_index - __tfind_page_size ))
fi
# Find history entries matching pattern *word1*~^*word2*~^*word3* etc.
local search_buffer="${BUFFER%% ##}" search_pattern="" csearch_pattern=""
search_buffer="${${search_buffer## ##}%% ##}"
search_buffer="${search_buffer//(#m)[][*?|#~^()><\\]/\\$MATCH}"
search_pattern="*${search_buffer// ##/*~^*}*"
csearch_pattern="${search_buffer// ##/|}"
if [[ $#__tfind_spe_found -eq 0 ]]; then
# The repeat will make the matching work on a fresh heap arena
repeat 1; do
# Match only before ^? ($'\177')
__tfind_spe_found=( "${(@M)__tfind_tag_data:#(#i)$~search_pattern*$'\177'*}" )
((__tfind_spe_funct)) && __tfind_spe_found=(${(M)__tfind_spe_found:#[[:alnum:]$TAG[fun-xt-chars]]##[[:space:]]#\([^\)]#\)[[:space:]]#(\{|)*})
((__tfind_spe_sort)) && __tfind_spe_found=(${(no)__tfind_spe_found})
done
fi
if ((!$#__tfind_spe_found)); then
_tfind_error_msg && return
fi
#
# Pagination, index value guards
#
integer page_size=$__tfind_page_size
integer max_index="$#__tfind_spe_found"
[[ $page_size -gt $max_index ]] && page_size=$max_index
[[ $__tfind_spe_index -le 0 ]] && __tfind_spe_index=$max_index
[[ $__tfind_spe_index -gt $max_index ]] && __tfind_spe_index=1
integer page_start_idx=$(( ((__tfind_spe_index-1)/page_size)*page_size+1 ))
integer on_page_idx=$(( (__tfind_spe_index-1) % page_size + 1 ))
#
# Prepare display
#
typeset -a disp_list
disp_list=( "${(@)__tfind_spe_found[page_start_idx,page_start_idx+page_size-1]}" )
# Remove meta-data from the entries
disp_list=( "${(@)disp_list//$'\177'*/}" )
# All entries should have multilines replaced
disp_list=( "${(@)disp_list//$'\n'/\\n}" )
# ... and truncated to display width, and
# also preceeded by two spaces
disp_list=( "${(@)disp_list/(#m)*/ ${MATCH[1,COLUMNS-8]}}" )
local p=$'\n'
local entry=$disp_list[on_page_idx]
entry[1]='»'
disp_list[on_page_idx]=$entry
#
# Detect where "> .." entry starts
#
local txt_before="${(F)${(@)disp_list[1,on_page_idx-1]}}"
#
# Colorify
#
local noun=${${${__tfind_spe_funct:#0}:+function}:-symbol}
local preamble=$'\n'"View of ${noun}s for repo: «««${(U)TAG[git-or-project]}»»» located at: $TAG[repo-dir]:h"$'\n'"${(C)noun} no. #$__tfind_spe_index. Found $max_index ${noun}s in the index."$'\n' \
key="Ctrl-f to toggle functions-ONLY view. Alt-s to toggle sort."$'\n'
preamble+=$key
local text="${(F)disp_list}"
integer offset=${#preamble}+$buflen
POSTDISPLAY="$preamble$text"
region_highlight=( "$(( offset + ${#txt_before} )) $(( offset + ${#txt_before} + ${#entry} + 1 )) underline" )
color_att() { local c;if (($4==0)){c=$__tfind_title_color;} elif (($4==1)){c=$__tfind_high_color;} elif (($4==4)){c=$__tfind_var_color;} elif (($4==7)){c=$__tfind_func_color;} elif (($4==9)){c=$__tfind_eqdol_color;} elif (($4==10)){c=$__tfind_macro_color;} else {c=$__tfind_arrow_color;}; region_highlight_+=("$(($1+$2-1)) $(($1+$3)) $c"); }
functions -M coloratt 4 4 color_att
local -a region_highlight_
# Also highlight project name
local h="$(( 30+buflen+__tfind_spe_funct*2 )) $(( 30+$buflen+${#TAG[git-or-project]}+__tfind_spe_funct*2 )) $__tfind_title_color"
local q="$buflen $offset $__tfind_heading_color"
region_highlight+=( $q $h )
: "${preamble//(#b)no. ([^.]##)./$((coloratt(buflen,mbegin[1],mend[1],0)))}"
: "${preamble//(#b)Found ([0-9]##)/$((coloratt(buflen,mbegin[1],mend[1],1)))}"
: "${preamble//(#b)» located at: ([^$p]##)/$((coloratt(buflen,mbegin[1],mend[1],1)))}"
: "${preamble//(#b)(Ctrl-f)/$((coloratt(buflen,mbegin[1],mend[1],0)))}"
: "${preamble//(#b)(Alt-s)/$((coloratt(buflen,mbegin[1],mend[1],0)))}"
: "${text//((#s)|$p)(#b)(»)/$((coloratt(offset,mbegin[1],mend[1],3)))}"
# Basic syntax highlighting - a few keywords like C/Java type names
: "${text//(#b)((([[:space:]\(\{\[]int|double|enum|short|long|(u|w|g|gu)(int|char|long|short)(8|16|32|64|128|max|)(_t|)|char|(|un)signed|FILE|const|restrict|size_t|va_list|ptrdiff_t|off_t|gboolean|gpointer|gconstpointer|typedef|static|struct|union)[[:space:]])|[a-zA-Z_]##_t|local|integer|float|declare|typeset|readonly)/$((coloratt(offset,mbegin[1],mend[1],4)))}"
: "${text//(#b)(=)/$((coloratt(offset,mbegin[1],mend[1],9)))}"
: "${text//(#b)(\#[[:space:]]#(include|define|if|endif))/$((coloratt(offset,mbegin[1],mend[1],10)))}"
: "${text//(#b)(\$<->#)/$((coloratt(offset,mbegin[1],mend[1],9)))}"
: "${text//(#b)([[:alnum:]$TAG[fun-xt-chars]]##)[[:space:]]#\([^\)]#\)/$((coloratt(offset,mbegin[1],mend[1],7)))}"
: "${text//(#b)\#[[:space:]]#(include|define)[[:space:]]##([[:alnum:]_]##)[^[:alnum:]_]/$((coloratt(offset,mbegin[2],mend[2],7)))}"
if [[ -n $search_pattern ]]; then
: "${(f)${(S)text//*(#bi)(${~csearch_pattern})/$((coloratt(offset,mbegin[1],mend[1],1)))}}"
fi
functions +M color_att
unfunction color_att
region_highlight+=( $region_highlight_ )
}
_tfind_functions() {
__tfind_spe_funct=1-__tfind_spe_funct
__tfind_spe_restart=1
_tfind_simulate_widget
}
_tfind_sort() {
__tfind_spe_sort=1-__tfind_spe_sort
__tfind_spe_restart=1
_tfind_simulate_widget
}
_tfind_simulate_widget() {
(( __tfind_spe_call_count ++ ))
_tfind_main
}
_tfind_self_insert() {
[[ $#KEYS ]] && __tfind_spe_restart=1
LBUFFER+="${KEYS[-1]}"
_tfind_simulate_widget
}
_tfind_backward_delete_char() {
[[ $#LBUFFER ]] && __tfind_spe_restart=1
LBUFFER="${LBUFFER%?}"
_tfind_simulate_widget
}
_tfind_delete_char() {
[[ $#RBUFFER ]] && __tfind_spe_restart=1
RBUFFER="${RBUFFER#?}"
_tfind_simulate_widget
}
_tfind_cancel_accept() {
BUFFER=""
__tfind_spe_index=-1
zle .accept-line
}
_tfind_main
if [[ $__tfind_spe_call_count -eq 1 ]]; then
# Make the tfind keymap a copy of the current main
bindkey -N tfind emacs
local down_widget="${${${WIDGET%-backwards}%-pbackwards}-pforwards}"
local up_widget="${down_widget}-backwards"
local pdown_widget="${down_widget}-pforwards"
local pup_widget="${down_widget}-pbackwards"
# Manual, termcap, terminfo
bindkey -M tfind '^[OA' $up_widget
bindkey -M tfind '^[OB' $down_widget
bindkey -M tfind '^[[A' $up_widget
bindkey -M tfind '^[[B' $down_widget
[[ -n "$termcap[ku]" ]] && bindkey -M tfind "$termcap[ku]" $up_widget
[[ -n "$termcap[kd]" ]] && bindkey -M tfind "$termcap[kd]" $down_widget
[[ -n "$termcap[kD]" ]] && bindkey -M tfind "$termcap[kD]" delete-char
[[ -n "$terminfo[kcuu1]" ]] && bindkey -M tfind "$terminfo[kcuu1]" $up_widget
[[ -n "$terminfo[kcud1]" ]] && bindkey -M tfind "$terminfo[kcud1]" $down_widget
[[ -n "$terminfo[kdch1]" ]] && bindkey -M tfind "$terminfo[kdch1]" delete-char
# More bindkeys, to remove influence of overloading plugins (sy-h, suggestions)
# Left/Right cursor keys
bindkey -M tfind '^[[D' .backward-char
bindkey -M tfind '^[[C' .forward-char
[[ -n "$termcap[kl]" ]] && bindkey -M tfind "$termcap[kl]" .backward-char
[[ -n "$termcap[kr]" ]] && bindkey -M tfind "$termcap[kr]" .forward-char
[[ -n "$terminfo[kcub1]" ]] && bindkey -M tfind "$terminfo[kcub1]" .backward-char
[[ -n "$terminfo[kcuf1]" ]] && bindkey -M tfind "$terminfo[kcuf1]" .forward-char
# Now Home/End keys, first few recorded in my .zshrc during the years sequences
bindkey -M tfind "\e[1~" .beginning-of-line
bindkey -M tfind "\e[7~" .beginning-of-line
bindkey -M tfind "\e[H" .beginning-of-line
bindkey -M tfind "\e[4~" .end-of-line
bindkey -M tfind "\e[F" .end-of-line
bindkey -M tfind "\e[8~" .end-of-line
[[ -n "$termcap[kh]" ]] && bindkey -M tfind "$termcap[kh]" .beginning-of-line
[[ -n "$termcap[@7]" ]] && bindkey -M tfind "$termcap[@7]" .end-of-line
[[ -n "$terminfo[khome]" ]] && bindkey -M tfind "$terminfo[khome]" .beginning-of-line
[[ -n "$terminfo[kend]" ]] && bindkey -M tfind "$terminfo[kend]" .end-of-line
# The same for Ctrl-E, Ctrl-F
bindkey -M tfind '^A' .beginning-of-line
bindkey -M tfind '^E' .end-of-line
# Additional keys
bindkey -M tfind '^[b' .backward-word
bindkey -M tfind '^[B' .backward-word
bindkey -M tfind '^[f' .forward-word
bindkey -M tfind '^[F' .forward-word
bindkey -M tfind '^[w' .forward-word
bindkey -M tfind '^[W' .forward-word
# Additional keys
bindkey -M tfind '^P' $up_widget
bindkey -M tfind '^N' $down_widget
# Page Up, Page Down keys
[[ -n "$termcap[kP]" ]] && bindkey -M tfind "$termcap[kP]" $pup_widget
[[ -n "$termcap[kN]" ]] && bindkey -M tfind "$termcap[kN]" $pdown_widget
[[ -n "$terminfo[kpp]" ]] && bindkey -M tfind "$terminfo[kpp]" $pup_widget
[[ -n "$terminfo[knp]" ]] && bindkey -M tfind "$terminfo[knp]" $pdown_widget
# Needed for Fedora 23, zsh-5.1.1
bindkey -M tfind ' ' self-insert
# Removal of default Ctrl-R binding
bindkey -M tfind '^R' $down_widget
# If one would like to re-open
bindkey -M tfind '^O' $down_widget
# Substitute self-insert, backward-delete-char, delete-char
zle -A self-insert saved-self-insert
zle -A backward-delete-char saved-backward-delete-char
zle -A delete-char saved-delete-char
zle -N self-insert _tfind_self_insert
zle -N backward-delete-char _tfind_backward_delete_char
zle -N delete-char _tfind_delete_char
zle -N tfind-functions _tfind_functions
zle -N tfind-sort _tfind_sort
# Override ourselves with what we actually are
# because zsh-autosuggestions change us
zle -A $down_widget saved-$down_widget
zle -A $up_widget saved-$up_widget
zle -N $down_widget _tfind_simulate_widget
zle -N $up_widget _tfind_simulate_widget
zle -A $pdown_widget saved-$pdown_widget
zle -A $pup_widget saved-$pup_widget
zle -N $pdown_widget _tfind_simulate_widget
zle -N $pup_widget _tfind_simulate_widget
if (( $+widgets[zle-line-pre-redraw] )); then
zle -A zle-line-pre-redraw saved-pre-redraw
zle -D zle-line-pre-redraw
fi
local selected_editor cd_at_edit tagtext tagline taglinebyte tagfile
local -a comm
comm=()
# Add Ctrl-V, ESC bindings to cancel search
# A workaround for Zsh versions like 5.0.2
zle -N _tfind_cancel_accept
bindkey -M tfind "^[" _tfind_cancel_accept
bindkey -M tfind "^f" tfind-functions
bindkey -M tfind "\es" tfind-sort
local redrawbkp=0
# Trap INT to manually interrupt Zle to work around a bug
trap 'zle && zle .send-break' INT
if zle .recursive-edit -K tfind; then
if ((__tfind_spe_index<=0)); then
:
else
zstyle -s ":plugin:zinit:symbol-search" editor selected_editor || selected_editor=${VISUAL:-${EDITOR:-mcedit}}
zstyle -T ":plugin:zinit:symbol-search" cd_at_edit && cd_at_edit=yes || cd_at_edit=no
(( ! $+commands[$selected_editor] )) && selected_editor=vim
(( ! $+commands[$selected_editor] )) && selected_editor=nano
(( ! $+commands[$selected_editor] )) && selected_editor=emacs
tagtext=$__tfind_spe_found[__tfind_spe_index]
if [[ $tagtext = (#b)[^$'\177']#$'\177'[^$'\1']#$'\1'([^$'\2']#)$'\2'(*) ]]; then
taglinebyte=${match[1]}
tagline=${taglinebyte%%,*}
# CD vs absolute path
if [[ $match[2] != /* && -n $TAG[repo-dir] ]]; then
tagfile=$TAG[repo-dir]/$match[2]
else
tagfile=$match[2]
fi
[[ ! -f $tagfile && -f $match[2] ]] && tagfile=$match[2]
# Editor command
case "$selected_editor" in
(vim|vi|gvim|mvim|nvim)
comm+=( $selected_editor "+$tagline" -- "${(q)tagfile}" )
;;
(emacs|emacsclient)
comm+=( $selected_editor "+$tagline" -- "${(q)tagfile}" )
;;
(gedit)
comm+=( $selected_editor "+$tagline" -- "${(q)tagfile}" )
;;
(nano)
comm+=( $selected_editor "+$tagline" -- "${(q)tagfile}" )
;;
(mcedit)
comm+=( $selected_editor "+$tagline" -- "${(q)tagfile}" )
;;
(*)
comm+=( $selected_editor "+$tagline" -- "${(q)tagfile}" )
;;
esac
fi
fi
else
BUFFER=""
fi
POSTDISPLAY=
# Restore self-insert, backward-delete-char, delete-char
zle -A saved-self-insert self-insert
zle -A saved-backward-delete-char backward-delete-char
zle -A saved-delete-char delete-char
zle -D saved-self-insert saved-backward-delete-char saved-delete-char
# Restore ourselves
zle -A saved-$down_widget $down_widget
zle -A saved-$up_widget $up_widget
zle -D saved-$down_widget saved-$up_widget
zle -A saved-$pdown_widget $pdown_widget
zle -A saved-$pup_widget $pup_widget
zle -D saved-$pdown_widget saved-$pup_widget
if (( $+widgets[saved-pre-redraw] )); then
zle -A saved-pre-redraw zle-line-pre-redraw
zle -D saved-pre-redraw
fi
# Full reinitialisation at next call
__tfind_spe_call_count=0
# Free memory
__tfind_spe_found=()
__tfind_tag_data=()
region_highlight=()
# Is there a command to run?
if [[ $#comm != 0 ]]; then
local auto_run
zstyle -T ":plugin:zinit" auto_run && auto_run=yes || auto_run=no
BUFFER=$comm[*]
CURSOR=$buflen
[[ $auto_run = yes ]] && zle .accept-line
fi
elif (( __tfind_spe_call_count > 0 )); then
(( __tfind_spe_call_count -- ))
fi
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View file

@ -1,219 +0,0 @@
# -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# Copyright (c) 2016-2020 Sebastian Gniazdowski and contributors.
# FUNCTION: :zinit-tmp-subst-source [[[
:zinit-tmp-subst-source() {
local -a ___substs ___ab
___substs=( "${(@s.;.)ICE[subst]}" )
if [[ -n ${(M)___substs:#*\\(#e)} ]] {
local ___prev
___substs=( ${___substs[@]//(#b)((*)\\(#e)|(*))/${match[3]:+${___prev:+$___prev\;}}${match[3]}${${___prev::=${match[2]:+${___prev:+$___prev\;}}${match[2]}}:+}} )
}
# Load the plugin
if [[ ! -r $1 ]] {
+zi-log "{error}source: Couldn't read the script {obj}${1}{error}" \
", cannot substitute {data}${ICE[subst]}{error}.{rst}"
}
local ___data="$(<$1)"
() {
builtin emulate -LR zsh -o extendedglob -o interactivecomments ${=${options[xtrace]:#off}:+-o xtrace}
local ___subst ___tabspc=$'\t'
for ___subst ( "${___substs[@]}" ) {
___ab=( "${(@)${(@)${(@s:->:)___subst}##[[:space:]]##}%%[[:space:]]##}" )
___ab[2]=${___ab[2]//(#b)\\([[:digit:]])/\${match[${match[1]}]}}
builtin eval "___data=\"\${___data//(#b)\${~___ab[1]}/${___ab[2]}}\""
}
___data="() { ${(F)${(@)${(f)___data[@]}:#[$___tabspc]#\#*}} ; } \"\${@[2,-1]}\""
}
builtin eval "$___data"
} # ]]]
# FUNCTION: .zinit-service [[[
# Handles given service, i.e. obtains lock, runs it, or waits if no lock
#
# $1 - type "p" or "s" (plugin or snippet)
# $2 - mode - for plugin (light or load)
# $3 - id - URL or plugin ID or alias name (from id-as'')
.zinit-service() {
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
setopt extendedglob warncreateglobal typesetsilent noshortloops
local ___tpe="$1" ___mode="$2" ___id="$3" ___fle="${ZINIT[SERVICES_DIR]}/${ICE[service]}.lock" ___fd ___cmd ___tmp ___lckd ___strd=0
{ builtin print -n >! "$___fle"; } 2>/dev/null 1>&2
[[ ! -e ${___fle:r}.fifo ]] && command mkfifo "${___fle:r}.fifo" 2>/dev/null 1>&2
[[ ! -e ${___fle:r}.fifo2 ]] && command mkfifo "${___fle:r}.fifo2" 2>/dev/null 1>&2
typeset -gx ZSRV_WORK_DIR="${ZINIT[SERVICES_DIR]}" ZSRV_ID="${ICE[service]}" # should be also set by other p-m
while (( 1 )); do
(
while (( 1 )); do
[[ ! -f ${___fle:r}.stop ]] && if (( ___lckd )) || zsystem 2>/dev/null 1>&2 flock -t 1 -f ___fd -e $___fle; then
___lckd=1
if (( ! ___strd )) || [[ $___cmd = RESTART ]]; then
[[ $___tpe = p ]] && { ___strd=1
.zinit-load "$___id" "" "$___mode" 0;
}
[[ $___tpe = s ]] && { ___strd=1
.zinit-load-snippet "$___id" "" 0;
}
fi
___cmd=
while (( 1 )); do builtin read -t 32767 ___cmd <>"${___fle:r}.fifo" && break; done
else
return 0
fi
[[ $___cmd = (#i)NEXT ]] && { kill -TERM "$ZSRV_PID"; builtin read -t 2 ___tmp <>"${___fle:r}.fifo2"; kill -HUP "$ZSRV_PID"; exec {___fd}>&-; ___lckd=0; ___strd=0; builtin read -t 10 ___tmp <>"${___fle:r}.fifo2"; }
[[ $___cmd = (#i)STOP ]] && { kill -TERM "$ZSRV_PID"; builtin read -t 2 ___tmp <>"${___fle:r}.fifo2"; kill -HUP "$ZSRV_PID"; ___strd=0; builtin print >! "${___fle:r}.stop"; }
[[ $___cmd = (#i)QUIT ]] && { kill -HUP ${sysparams[pid]}; return 1; }
[[ $___cmd != (#i)RESTART ]] && { ___cmd=; builtin read -t 1 ___tmp <>"${___fle:r}.fifo2"; }
done
) || break
builtin read -t 1 ___tmp <>"${___fle:r}.fifo2"
done >>! "$ZSRV_WORK_DIR/$ZSRV_ID".log 2>&1
} # ]]]
# FUNCTION: .zinit-wrap-track-functions [[[
.zinit-wrap-track-functions() {
local user="$1" plugin="$2" id_as="$3" f
local -a wt
wt=( ${(@s.;.)ICE[wrap-track]} )
for f in ${wt[@]}; do
functions[${f}-zinit-bkp]="${functions[$f]}"
eval "
function $f {
ZINIT[CUR_USR]=\"$user\" ZINIT[CUR_PLUGIN]=\"$plugin\" ZINIT[CUR_USPL2]=\"$id_as\"
.zinit-add-report \"\${ZINIT[CUR_USPL2]}\" \"Note: === Starting to track function: $f ===\"
.zinit-diff \"\${ZINIT[CUR_USPL2]}\" begin
.zinit-tmp-subst-on load
functions[${f}]=\${functions[${f}-zinit-bkp]}
${f} \"\$@\"
.zinit-tmp-subst-off load
.zinit-diff \"\${ZINIT[CUR_USPL2]}\" end
.zinit-add-report \"\${ZINIT[CUR_USPL2]}\" \"Note: === Ended tracking function: $f ===\"
ZINIT[CUR_USR]= ZINIT[CUR_PLUGIN]= ZINIT[CUR_USPL2]=
}"
done
} # ]]]
#
# debug command
#
# FUNCTION: .zinit-debug-clear [[[
# Clear latest debug report
.zinit-debug-clear() {
{
.zinit-clear-report-for _dtrace/_dtrace
+zi-log '{m} Cleared debug report'
} || {
+zi-log '{e} Failed to clear debug report'
return 1
}
} # ]]]
# FUNCTION: .zinit-debug-report [[[
# Displays debug report (data recorded in interactive session).
.zinit-debug-report() {
if [[ ${ZINIT[DTRACE]} = 1 ]]; then
+zi-log "{e} Debug mode active, stop it first via {cmd}zinit debug stop{rst}"
else
(( ${+functions[.zinit-unload]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh" || return 1
.zinit-show-report "_dtrace/_dtrace"
fi
} # ]]]
# FUNCTION: .zinit-debug-revert [[[
# Revert changes made during debug mode
.zinit-debug-revert() {
if [[ ${ZINIT[DTRACE]} = 1 ]]; then
+zi-log "{e} Debug mode is active. To stop, run {cmd}zinit debug stop{rst}"
else
(( ${+functions[.zinit-unload]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh" || return 1
.zinit-unload _dtrace _dtrace
+zi-log "{m} Reverted changes detected during debug mode"
fi
} # ]]]
# FUNCTION: .zinit-debug-start [[[
# Start debug mode
.zinit-debug-start() {
if [[ $ZINIT[DTRACE] = 1 ]]; then
+zi-log "{e} Debug mode currently active"
return 1
fi
(){
ZINIT[DTRACE]=1
.zinit-diff _dtrace/_dtrace begin
.zinit-tmp-subst-on dtrace
}
if (( $? == 0 )); then
+zi-log "{i} Started debug mode"
return 0
fi
} # ]]]
# FUNCTION: .zinit-debug-status [[[
# Revert changes made during debug mode
.zinit-debug-status() {
+zi-log -n '{m} Debug mode: '
(( ZINIT[DTRACE] )) && +zi-log 'running' || +zi-log 'stopped'
} # ]]]
# FUNCTION: .zinit-debug-stop [[[
# Stop debug mode
.zinit-debug-stop() {
if [[ $ZINIT[DTRACE] = 0 ]]; then
+zi-log '{e} Debug mode not active'
return 0
else
ZINIT[DTRACE]=0
(){
.zinit-tmp-subst-off dtrace # turn of shadowing
.zinit-diff _dtrace/_dtrace end # get end data to diff later
}
if (( $? == 0 )); then
+zi-log '{i} Stopped debug mode'
return 0
fi
fi
} # ]]]
# FUNCTION: +zinit-debug [[[
# Debug command entry point
+zinit-debug(){
emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
setopt extendedglob noksharrays nokshglob nullglob typesetsilent warncreateglobal
local o_help cmd
local -a usage=(
'Usage:'
' zinit debug [options] [command]'
' '
'Options:'
' -h, --help Show list of command-line options'
' '
'Commands:'
' clear Clear debug report'
' report Show debug report'
' revert Revert changes made during debug mode'
' start Start debug mode'
' status Current debug status'
' stop Stop debug mode'
)
zmodload zsh/zutil
zparseopts -D -F -K -- \
{h,-help}=o_help \
|| return 1
(( $#o_help )) && {
print -l -- $usage
return 0
}
cmd="$1"
if (( ! $+functions[.zinit-debug-${cmd}] )); then
print -l -- $usage
return 1
else
.zinit-debug-${cmd} "${(@)@:2}"
fi
} # ]]]
# vim: ft=zsh sw=4 ts=4 et foldmarker=[[[,]]] foldmethod=marker

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,397 +0,0 @@
#!/usr/bin/env zsh
#
# Copyright (c) 2016-2020 Sebastian Gniazdowski and contributors
# Copyright (c) 2021-2022 zdharma-continuum and contributors
# FUNCTION: .zinit-any-colorify-as-uspl2 [[[
# Returns ANSI-colorified "user/plugin" string, from any supported
# plugin spec (user---plugin, user/plugin, user plugin, plugin).
#
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
# $2 - plugin (only when $1 - i.e. user - given)
#
# $REPLY - ANSI-colorified "user/plugin" string
.zinit-any-colorify-as-uspl2() {
.zinit-any-to-user-plugin "$1" "$2"
local user="${reply[-2]}" plugin="${reply[-1]}"
if [[ "$user" = "%" ]]; then
.zinit-any-to-pid "" $plugin
REPLY="${REPLY/https--github.com--(robbyrussell--oh-my-zsh|ohmyzsh--ohmyzsh)--trunk--plugins--/OMZP::}"
REPLY="${REPLY/https--github.com--(robbyrussell--oh-my-zsh|ohmyzsh--ohmyzsh)--trunk--plugins/OMZP}"
REPLY="${REPLY/https--github.com--(robbyrussell--oh-my-zsh|ohmyzsh--ohmyzsh)--trunk--lib--/OMZL::}"
REPLY="${REPLY/https--github.com--(robbyrussell--oh-my-zsh|ohmyzsh--ohmyzsh)--trunk--lib/OMZL}"
REPLY="${REPLY/https--github.com--(robbyrussell--oh-my-zsh|ohmyzsh--ohmyzsh)--trunk--themes--/OMZT::}"
REPLY="${REPLY/https--github.com--(robbyrussell--oh-my-zsh|ohmyzsh--ohmyzsh)--trunk--themes/OMZT}"
REPLY="${REPLY/https--github.com--(robbyrussell--oh-my-zsh|ohmyzsh--ohmyzsh)--trunk--/OMZ::}"
REPLY="${REPLY/https--github.com--(robbyrussell--oh-my-zsh|ohmyzsh--ohmyzsh)--trunk/OMZ}"
REPLY="${REPLY/https--github.com--sorin-ionescu--prezto--trunk--modules--/PZTM::}"
REPLY="${REPLY/https--github.com--sorin-ionescu--prezto--trunk--modules/PZTM}"
REPLY="${REPLY/https--github.com--sorin-ionescu--prezto--trunk--/PZT::}"
REPLY="${REPLY/https--github.com--sorin-ionescu--prezto--trunk/PZT}"
REPLY="${REPLY/(#b)%([A-Z]##)(#c0,1)(*)/%$ZINIT[col-uname]$match[1]$ZINIT[col-pname]$match[2]$ZINIT[col-rst]}"
elif [[ $user == http(|s): ]]; then
REPLY="${ZINIT[col-ice]}${user}/${plugin}${ZINIT[col-rst]}"
else
REPLY="${user:+${ZINIT[col-uname]}${user}${ZINIT[col-rst]}/}${ZINIT[col-pname]}${plugin}${ZINIT[col-rst]}"
fi
} # ]]]
# FUNCTION: .zinit-compute-ice [[[
# Computes ICE array
# - input
# - static
# - saved
# taking priorities into account.
# Can also pack resulting ices into ZINIT_SICE (see $2).
# Returns filepath to snippet directory and optional snippet file name (only
# valid if ICE[svn] is not set).
#
# $1 - URL (also plugin-spec)
# $2 - "pack" or "nopack" or "pack-nf" - packing means ICE
# wins with static ice; "pack-nf" means that disk-ices will
# be ignored (no-file?)
# $3 - name of output associative array, "ICE" is the default
# $4 - name of output string parameter, to hold path to directory ("local_dir")
# $5 - name of output string parameter, to hold filename ("filename")
# $6 - name of output string parameter, to hold is-snippet 0/1-bool ("is_snippet")
#
# $REPLY - snippet directory filepath
.zinit-compute-ice() {
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
setopt extendedglob typesetsilent warncreateglobal noshortloops
local ___URL="${1%/}" ___pack="$2" ___is_snippet=0
local ___var_name1="${3:-ZINIT_ICE}" ___var_name2="${4:-local_dir}" ___var_name3="${5:-filename}" ___var_name4="${6:-is_snippet}"
# Copy from .zinit-recall
local -a ice_order nval_ices
ice_order=(
${(s.|.)ZINIT[ice-list]}
# include all additional ices after stripping them from the possible: ''
${(@)${(@Akons:|:)${ZINIT_EXTS[ice-mods]//\'\'/}}/(#s)<->-/}
)
nval_ices=(
${(s.|.)ZINIT[nval-ice-list]}
# include only those additional ices, don't have the '' in their name, i.e.
# aren't designed to hold value
${(@)${(@)${(@Akons:|:)ZINIT_EXTS[ice-mods]}:#*\'\'*}/(#s)<->-/}
svn
)
# strip whitespace from beginning of url
___URL="${${___URL#"${___URL%%[! $'\t']*}"}%/}"
# snippet
.zinit-two-paths "$___URL"
local ___s_path="${reply[-4]}" ___s_svn="${reply[-3]}" ___path="${reply[-2]}" ___filename="${reply[-1]}" ___local_dir
if [[ -d "$___s_path" || -d "$___path" ]]; then
___is_snippet=1
else
# plugin
.zinit-any-to-user-plugin "$___URL" ""
local ___user="${reply[-2]}" ___plugin="${reply[-1]}"
___s_path="" ___filename=""
[[ "$___user" = "%" ]] && ___path="$___plugin" || ___path="${ZINIT[PLUGINS_DIR]}/${___user:+${___user}---}${___plugin//\//---}"
.zinit-exists-physically-message "$___user" "$___plugin" || return 1
fi
[[ $___pack = pack* ]] && (( ${#ICE} > 0 )) && .zinit-pack-ice "${___user-$___URL}" "$___plugin"
local -A ___sice
local -a ___tmp
___tmp=( "${(z@)ZINIT_SICE[${___user-$___URL}${${___user:#(%|/)*}:+/}$___plugin]}" )
(( ${#___tmp[@]} > 1 && ${#___tmp[@]} % 2 == 0 )) && ___sice=( "${(Q)___tmp[@]}" )
if [[ "${+___sice[svn]}" = "1" || -n "$___s_svn" ]]; then
if (( !___is_snippet && ${+___sice[svn]} == 1 )); then
builtin print -r -- "The \`svn' ice is given, but the argument ($___URL) is a plugin"
builtin print -r -- "(\`svn' can be used only with snippets)"
return 1
elif (( !___is_snippet )); then
builtin print -r -- "Undefined behavior #1 occurred, please report at https://github.com/zdharma-continuum/zinit/issues"
return 1
fi
if [[ -e "$___s_path" && -n "$___s_svn" ]]; then
___sice[svn]=""
___local_dir="$___s_path"
else
if [[ ! -e "$___path" ]] {
builtin print -r -- "No such snippet, looked at paths (1): $___s_path, and: $___path";
return 1;
}
unset '___sice[svn]'
___local_dir="$___path"
fi
else
if [[ -e "$___path" ]]; then
unset '___sice[svn]'
___local_dir="$___path"
else
builtin print -r -- "No such snippet, looked at paths (2): $___s_path, and: $___path"
return 1
fi
fi
local ___zinit_path="$___local_dir/._zinit"
# read disk-ice
local -A ___mdata
local ___key
{
for ___key in mode url is_release is_release{2..5} ${ice_order[@]}; do
[[ -f "$___zinit_path/$___key" ]] && ___mdata[$___key]="$(<$___zinit_path/$___key)"
done
[[ "${___mdata[mode]}" = "1" ]] && ___mdata[svn]=""
} 2>/dev/null
# handle flag-ices; svn must be last
for ___key in ${ice_order[@]}; do
[[ $___key == (no|)compile ]] && continue
if (( 0 == ${+ICE[no$___key]} && 0 == ${+___sice[no$___key]} )) {
continue
}
# "If there is such ice currently, and there's no no* ice given, and
# there's the no* ice in the static ice" skip, don't unset. With
# conjunction with the previous line this has the proper meaning: uset if
# at least in one  current or static ice there is the no* ice unless it
# is the only in the static ice (unless there's on such ice "anyway").
if (( 1 == ${+ICE[$___key]} && 0 == ${+ICE[no$___key]} && 1 == ${+___sice[no$___key]} )) {
continue
}
if [[ "$___key" = "svn" ]]; then
command builtin print -r -- "0" >! "$___zinit_path/mode"
___mdata[mode]=0
else
command rm -f -- "$___zinit_path/$___key"
fi
unset "___mdata[$___key]" "___sice[$___key]" "ICE[$___key]"
done
# final decision, static ice vs. saved ice
local -A ___MY_ICE
for ___key in mode url is_release is_release{2..5} ${ice_order[@]}; do
# The second sum is: if the pack is *not* pack-nf, then depending on the
# disk availability, otherwise: no disk ice
(( ${+___sice[$___key]} + ${${${___pack:#pack-nf*}:+${+___mdata[$___key]}}:-0} )) && ___MY_ICE[$___key]="${___sice[$___key]-${___mdata[$___key]}}"
done
# One more round for the special case update, which ALWAYS needs the teleid
# from the disk or static ice
___key=teleid; [[ "$___pack" = pack-nftid ]] && {
(( ${+___sice[$___key]} + ${+___mdata[$___key]} )) && ___MY_ICE[$___key]="${___sice[$___key]-${___mdata[$___key]}}"
}
: ${(PA)___var_name1::="${(kv)___MY_ICE[@]}"}
: ${(P)___var_name2::=$___local_dir}
: ${(P)___var_name3::=$___filename}
: ${(P)___var_name4::=$___is_snippet}
return 0
} # ]]]
# FUNCTION: .zinit-countdown [[[
# Displays a countdown 5...4... etc.
#
# $REPLY - 1 if Ctrl-C is pressed, otherwise 0
.zinit-countdown() {
(( !${+ICE[countdown]} )) && return 0
builtin emulate -L zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
trap "+zi-log \"{ehi}ABORTING, the ice {ice}$ice{ehi} not ran{rst}\"; return 1" INT
local count=5 ice tpe="$1"
ice="${ICE[$tpe]}"
[[ $tpe = "atpull" && $ice = "%atclone" ]] && ice="${ICE[atclone]}"
ice="{b}{ice}$tpe{ehi}:{rst}${ice//(#b)(\{[a-z0-9…_-]##\})/\\$match[1]}"
+zi-log -n "{hi}Running $ice{rst}{hi} ice in...{rst} "
while (( -- count + 1 )) {
+zi-log -n -- "{b}{error}"$(( count + 1 ))"{rst}{…}"
sleep 1
}
+zi-log -r -- "{b}{error}0 <running now>{rst}{…}"
return 0
} # ]]]
# FUNCTION: .zinit-exists-physically [[[
# Checks if directory of given plugin exists in PLUGIN_DIR.
#
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
# $2 - plugin (only when $1 - i.e. user - given)
.zinit-exists-physically() {
.zinit-any-to-user-plugin "$1" "$2"
if [[ ${reply[-2]} = % ]]; then
[[ -d ${reply[-1]} ]] && return 0 || return 1
else
[[ -d ${ZINIT[PLUGINS_DIR]}/${reply[-2]:+${reply[-2]}---}${reply[-1]//\//---} ]] \
&& return 0 \
|| return 1
fi
} # ]]]
# FUNCTION: .zinit-exists-physically-message [[[
# Checks if directory of given plugin exists in PLUGIN_DIR, and outputs error
# message if it doesn't.
#
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
# $2 - plugin (only when $1 - i.e. user - given)
.zinit-exists-physically-message() {
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
builtin setopt extendedglob warncreateglobal typesetsilent noshortloops rcquotes
if ! .zinit-exists-physically "$1" "$2"; then
.zinit-any-to-user-plugin "$1" "$2"
if [[ $reply[1] = % ]]; then
.zinit-any-to-pid "$1" "$2"
local spec1=$REPLY
if [[ $1 = %* ]]; then
local spec2=%${1#%}${${1#%}:+${2:+/}}$2
elif [[ -z $1 || -z $2 ]]; then
local spec3=%${1#%}${2#%}
fi
else
integer nospec=1
fi
.zinit-any-colorify-as-uspl2 "$1" "$2"
+zi-log "{error}No such (plugin or snippet){rst}: $REPLY."
[[ $nospec -eq 0 && $spec1 != $spec2 ]] \
&& +zi-log "(expands to: {file}${spec2#%}{rst})."
return 1
fi
return 0
} # ]]]
# FUNCTION: .zinit-first [[[
# Finds the main file of plugin. There are multiple file name formats, they are
# ordered in order starting from more correct ones, and matched.
# .zinit-load-plugin() has similar code parts and doesn't call .zinit-first()
# for performance. Obscure matching is done in .zinit-find-other-matches, here
# and in .zinit-load(). Obscure = non-standard main-file naming convention.
#
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
# $2 - plugin (only when $1 - i.e. user - given)
.zinit-first() {
.zinit-any-to-user-plugin "$1" "$2"
local user="${reply[-2]}" plugin="${reply[-1]}"
.zinit-any-to-pid "$1" "$2"
.zinit-get-object-path plugin "$REPLY"
integer ret=$?
local dname="$REPLY"
(( ret )) && { reply=( "$dname" "" ); return 1; }
# look for file to compile - first look for the most common one (optimization)
# then for other possibilities
if [[ -e "$dname/$plugin.plugin.zsh" ]]; then
reply=( "$dname/$plugin.plugin.zsh" )
else
.zinit-find-other-matches "$dname" "$plugin"
fi
if [[ "${#reply}" -eq "0" ]]; then
reply=( "$dname" "" )
return 1
fi
# take first entry (ksharrays resilience)
reply=( "$dname" "${reply[-${#reply}]}" )
return 0
} # ]]]
# FUNCTION: .zinit-store-ices [[[
# Saves ice mods in given hash onto disk.
#
# $1 - directory where to create or delete files
# $2 - name of hash that holds values
# $3 - additional keys of hash to store, space separated
# $4 - additional keys of hash to store, empty-meaningful ices, space separated
# $5 URL, if applicable
# $6 mode, svn=1, 0=single file
.zinit-store-ices() {
local ___pfx="$1" ___ice_var="$2" ___add_ices="$3" ___add_ices2="$4"
local url="$5" mode="$6"
# Copy from zinit-recall response
local -a ice_order nval_ices
ice_order=(
${(s.|.)ZINIT[ice-list]}
# include all additional ices after stripping them from the possible: ''
${(@)${(@Akons:|:)${ZINIT_EXTS[ice-mods]//\'\'/}}/(#s)<->-/}
)
nval_ices=(
${(s.|.)ZINIT[nval-ice-list]}
# include only those additional ices, don't have the '' in their name, i.e.
# aren't designed to hold value
${(@)${(@)${(@Akons:|:)ZINIT_EXTS[ice-mods]}:#*\'\'*}/(#s)<->-/}
# must be last
svn
)
command mkdir -p "$___pfx" && echo '*' > "$___pfx/.gitignore"
local ___key ___var_name
# No nval_ices here
for ___key in ${ice_order[@]:#(${(~j:|:)nval_ices[@]})} ${(s: :)___add_ices[@]}; do
___var_name="${___ice_var}[$___key]"
(( ${(P)+___var_name} )) && builtin print -r -- "${(P)___var_name}" >! "$___pfx"/"$___key"
done
# Ices that even empty mean something
for ___key in ${nval_ices[@]} ${(s: :)___add_ices2[@]}; do
___var_name="${___ice_var}[$___key]"
if (( ${(P)+___var_name} )); then
builtin print -r -- "${(P)___var_name}" >! "$___pfx"/"$___key"
else
command rm -f "$___pfx"/"$___key"
fi
done
# url and mode are declared at the beginning of the body
for ___key in url mode; do
[[ -n "${(P)___key}" ]] && builtin print -r -- "${(P)___key}" >! "$___pfx"/"$___key"
done
} # ]]]
# FUNCTION: .zinit-two-paths [[[
# Obtains a snippet URL without specification if it is an SVN URL (points to
# directory) or regular URL (points to file), returns 2 possible paths for
# further examination
#
# $REPLY - two filepaths
.zinit-two-paths() {
builtin emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
setopt extendedglob typesetsilent warncreateglobal noshortloops
local dirnameA dirnameB local_dirA local_dirB svn_dirA url1 url2 url=$1
local -a fileB_there
# remove leading whitespace and trailing /
url="${${url#"${url%%[! $'\t']*}"}%/}"
url1=$url
url2=$url
.zinit-get-object-path snippet "$url1"
local_dirA=$reply[-3] dirnameA=$reply[-2]
[[ -d "$local_dirA/$dirnameA/.svn" ]] && {
svn_dirA=".svn"
if { .zinit-first % "$local_dirA/$dirnameA"; } {
fileB_there=( ${reply[-1]} )
}
}
.zinit-get-object-path snippet "$url2"
local_dirB=$reply[-3] dirnameB=$reply[-2]
[[ -z $svn_dirA ]] && fileB_there=( "$local_dirB/$dirnameB"/*~*.(zwc|md|js|html)(.-DOnN[1]) )
reply=( "$local_dirA/$dirnameA" "$svn_dirA" "$local_dirB/$dirnameB" "${fileB_there[1]##$local_dirB/$dirnameB/#}" )
} # ]]]
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et foldmarker=[[[,]]] foldmethod=marker

3450
zinit.zsh

File diff suppressed because it is too large Load diff

16
zmodules/.cvsignore Normal file
View file

@ -0,0 +1,16 @@
Makefile
META-FAQ
config.cache
config.h
config.h.in
config.log
config.modules
config.modules.sh
config.status
configure
cscope.out
stamp-h
stamp-h.in
autom4te.cache
*.swp
.git

4
zmodules/.distfiles Normal file
View file

@ -0,0 +1,4 @@
DISTFILES_SRC='
META-FAQ
configure config.h.in stamp-h.in
'

Some files were not shown because too many files have changed in this diff Show more