Compare commits

..
32 Commits
Author SHA1 Message Date
Jakub Boukal 5873e1cfec docs(python): add PYTHON_AUTO_VRUN to settings (#14233) 2026-11-27 16:20:27 -08:00
alexanderxc 03ba23c9f6 chore(brew): use bu instead of bubo in bubu (#14229) 2026-11-27 16:19:51 -08:00
PerryLink 597dff9477 fix(extract): untar .tar.Z and .taz archives (#14223) 2026-11-27 16:19:46 -08:00
Marco Trevisan 80ec81e340 feat(clipboard): add OSC 52 fallback (#14251)
OSC 52 makes the terminal emulator set the clipboard of the machine the
user is connected from, which is the only way to copy to it when running
over SSH or inside a container with no access to the local display
server.

Use it when no other clipboard tool is available, or when
ZSH_CLIPBOARD_OSC52 is set to "always"; set it to "never" to disable the
fallback. OSC 52 is write-only in practice, so clippaste keeps failing
unless a real clipboard tool is available.

Closes #13459
2026-11-27 16:19:24 -08:00
Sam Thomas 22c883efa4 fix(dotenv): bypass aliases when checking .env syntax (#14179) 2026-11-27 15:33:11 -08:00
Sam Thomas da85047297 fix(updater): bypass aliases when calling zsh in update check (#14178) 2026-11-27 15:33:06 -08:00
Jay Pokale 113f9b2475 fix(cli): remove adjacent plugins in omz plugin disable (#14303) 2026-11-27 15:19:41 -08:00
Martin Darmüntzel 507561c236 fix(macos): set shuffle with Music's shuffle property in music shuffle (#13365) 2026-11-27 14:58:20 -08:00
Hobeom Jeon d419792761 feat(conda): add environment completion for cna and cnrn (#13632) 2026-11-27 14:54:10 -08:00
Hobeom Jeon 90e5779f1f feat(zellij): add zellij plugin (#13624) 2026-11-27 14:54:06 -08:00
gbaian10 1dc43bfe53 fix(pre-commit): use autoupdate for prek (#14295)
Closes #14294
2026-11-27 14:46:13 -08:00
Rasmus Skovgaard Lauritsen 387dfe0bfb feat(fizzy): add completion plugin (#14297) 2026-11-27 14:46:09 -08:00
Sanjay Doppalapudi 32726ad0a5 fix(extract): unpack .tar.lzma archives (#14298) 2026-11-27 14:46:04 -08:00
Hegui Dai 2cd4cc21fc feat(jj): add jjgpb alias for jj git push --bookmark (#14302) 2026-11-27 14:45:52 -08:00
anacletoTM aa9ca00520 refactor(laravel): consolidate versioned plugins (#14282)
* refactor(laravel): consolidate versioned plugins

* fix(laravel): scope legacy aliases and defer command discovery
2026-11-27 13:31:49 -08:00
Alexander Schaber 924db8c81b refactor(plugins): use cached background completion generation (#13662)
Move invoke, istioctl, kn, kompose, kops, oc, operator-sdk, please and
svcat off sourcing `<($cmd completion ...)` on every startup. The
completion script is now cached under $ZSH_CACHE_DIR/completions and
regenerated in the background, following the pattern used by the helm
plugin.

Writes go through a temp file (prefixed with a dot to keep it out of
$fpath) that is moved into place atomically with `zf_mv`, so a
half-written file is never sourced.
2026-11-27 13:23:29 -08:00
원영 53f0790157 feat(git): add gsms alias for git submodule status (#13586) 2026-11-27 13:22:57 -08:00
Jim Weller abfce729ab feat(terragrunt): add terragrunt plugin (#13261) 2026-11-26 07:29:16 -08:00
Shahab Ahmed 070831e592 fix(extract): extract .deb members without double nesting (#14199)
Closes #14200
2026-11-26 07:29:06 -08:00
Federico Tensi e333686c2a feat(git-commit): support optional commit body (#14169) 2026-11-26 07:28:56 -08:00
Nuri Jung b1d468701a fix(git): remove unnecessary git rm from gwip (#13410) 2026-11-26 07:28:45 -08:00
kang 12a6ce7e42 feat(python): add recursive parent directory search for auto_vrun (#13523) 2026-11-26 07:20:36 -08:00
Kennan LeJeune f5a74e0347 feat(fnox): add plugin (#13593) 2026-11-26 07:20:27 -08:00
Randommisha13 0876f10264 feat(systemd): support other privilege elevation tools (#13695) 2026-11-26 07:20:17 -08:00
Thejesh 4d643a3c86 fix(web-search): escape reserved characters like + and & (#14275) 2026-11-26 07:20:09 -08:00
Thejesh 1a05a1091b fix(cli): add plugins to an empty plugins=() list (#14276) 2026-11-26 06:51:15 -08:00
Jonathan Stacks ad66117d08 feat(talosctl): add completions for talosctl (#13682) 2026-11-26 06:50:09 -08:00
Morningstar202604 964e5b65c6 fix(vi-mode): fix stale clipboard retry after failed push (#14141) 2026-11-26 06:45:29 -08:00
Ngonidzashe Mangudya 1eebae3a3f feat(laravel): add aliases for nWidart/laravel-modules (#14293) 2026-11-25 06:15:06 -08:00
mattmc3 ca5b808de8 feat(zsh-patina): add completions (#14296) 2026-11-25 06:11:57 -08:00
mattmc3 c8aea70a11 feat(zsh-patina): add completions (#14296) 2026-11-25 06:02:51 -08:00
Ininsico 799f9a8a8a fix(colorize): pass ZSH_COLORIZE_CHROMA_FORMATTER to cless (#13781)
Closes #12650
2026-11-24 21:22:08 -08:00
70 changed files with 1245 additions and 5919 deletions

No files matched your search

-20
View File
@@ -6,8 +6,6 @@ updates:
interval: "weekly" interval: "weekly"
day: "sunday" day: "sunday"
labels: [] labels: []
cooldown:
default-days: 7
groups: groups:
gha-minor: gha-minor:
patterns: patterns:
@@ -21,8 +19,6 @@ updates:
interval: "weekly" interval: "weekly"
day: "sunday" day: "sunday"
labels: [] labels: []
cooldown:
default-days: 7
groups: groups:
py-minor: py-minor:
patterns: patterns:
@@ -30,19 +26,3 @@ updates:
update-types: update-types:
- minor - minor
- patch - patch
- package-ecosystem: npm
directory: "/.github/workflows/installer"
schedule:
interval: "weekly"
day: "sunday"
labels: []
cooldown:
default-days: 7
groups:
npm-minor:
patterns:
- "*"
update-types:
- major
- minor
- patch
-45
View File
@@ -1,45 +0,0 @@
# Workflow checks
The `Workflow lint` workflow runs jactionlint on pull requests and pushes to
`master`. It checks workflows and Dependabot configuration with the default
profile, including ShellCheck for inline shell scripts. It runs without online
checks or publishing credentials.
To run the same checks locally, install jactionlint 2.6.0 and ShellCheck, then run
from the repository root:
```sh
jactionlint --profile=default --no-online
```
Keep the local jactionlint version aligned with the pinned action in `lint.yml`.
There is no baseline: new findings fail the check. Any rule exception should be
limited to the relevant line and explain why it is needed.
## Project tracking
`project.yml` intentionally uses `pull_request_target` so the GitHub App can add
fork contributions to the project board. It must not check out or execute PR
code. Project IDs are validated before passing them through step outputs, and
PR-derived plugin/theme names are restricted to letters, digits, dots, underscores
and hyphens.
The App tokens request explicit permissions: project tracking needs organization
projects write access and issues/pull requests read access; dependency updates
need contents read access and issues/pull requests write access. Dependency pushes
use the job's separate `GITHUB_TOKEN` with contents write access.
## Installer deployment
The Vercel CLI is pinned in `installer/package.json` and `installer/package-lock.json`.
Dependabot checks this dependency weekly, with a seven-day cooldown for version
updates, like the other configured ecosystems. Deployment installs the lockfile
with `npm ci --ignore-scripts`; `.vercelignore` uploads only `install.sh`.
After changing the CLI version, update its lockfile and verify the CLI locally:
```sh
npm install --package-lock-only --ignore-scripts --prefix .github/workflows/installer
npm ci --ignore-scripts --prefix .github/workflows/installer
.github/workflows/installer/node_modules/.bin/vercel --version
```
-4
View File
@@ -11,7 +11,6 @@ jobs:
check: check:
name: Check for updates name: Check for updates
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
permissions: permissions:
contents: write # this is needed to push commits and branches contents: write # this is needed to push commits and branches
@@ -31,9 +30,6 @@ jobs:
with: with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }} client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
permission-contents: read
permission-issues: write
permission-pull-requests: write
- name: Setup Python - name: Setup Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with: with:
+2 -12
View File
@@ -19,7 +19,6 @@ jobs:
name: Test installer name: Test installer
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy: strategy:
matrix: matrix:
os: os:
@@ -43,7 +42,6 @@ jobs:
name: Deploy installer in install.ohmyz.sh name: Deploy installer in install.ohmyz.sh
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15
environment: vercel environment: vercel
needs: needs:
- test - test
@@ -55,16 +53,8 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
package-manager-cache: false
- name: Install Vercel CLI - name: Install Vercel CLI
working-directory: .github/workflows/installer run: npm install -g vercel
run: npm ci --ignore-scripts --no-audit --no-fund
- name: Setup project and deploy - name: Setup project and deploy
env: env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
@@ -73,4 +63,4 @@ jobs:
run: | run: |
cp tools/install.sh .github/workflows/installer/install.sh cp tools/install.sh .github/workflows/installer/install.sh
cd .github/workflows/installer cd .github/workflows/installer
./node_modules/.bin/vercel deploy --prod -t "$VERCEL_TOKEN" vc deploy --prod -t "$VERCEL_TOKEN"
-1
View File
@@ -1,2 +1 @@
install.sh install.sh
node_modules/
File diff suppressed because it is too large. Load diff
-7
View File
@@ -1,7 +0,0 @@
{
"name": "ohmyzsh-installer-deploy",
"private": true,
"devDependencies": {
"vercel": "66.6.0"
}
}
-33
View File
@@ -1,33 +0,0 @@
name: Workflow lint
on:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
jactionlint:
name: Lint GitHub Actions
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@aebdcf6156ab6691adf63218240e476564a1ed4c # v2.23.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Lint workflows and Dependabot configuration
uses: jdx/jactionlint@72c00452809bcca05b8bc12acdcf15dd7a9c1c5e # v2.6.0
with:
profile: default
online: "false"
-1
View File
@@ -21,7 +21,6 @@ jobs:
tests: tests:
name: Run tests name: Run tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
+9 -41
View File
@@ -2,8 +2,6 @@ name: Project tracking
on: on:
issues: issues:
types: [opened, reopened] types: [opened, reopened]
# Board updates need an App token for fork PRs; no PR code is checked out or run.
# jactionlint ignore=dangerous-triggers
pull_request_target: pull_request_target:
types: [opened, reopened, synchronize] types: [opened, reopened, synchronize]
@@ -16,10 +14,6 @@ jobs:
add-to-project: add-to-project:
name: Add to project name: Add to project
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
@@ -32,19 +26,13 @@ jobs:
with: with:
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }} client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
permission-organization-projects: write
permission-issues: read
permission-pull-requests: read
- name: Read project data - name: Read project data
id: project
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
ORGANIZATION: ohmyzsh ORGANIZATION: ohmyzsh
PROJECT_NUMBER: "1" PROJECT_NUMBER: "1"
run: | run: |
# Get Project data # Get Project data
# GraphQL variables must reach GitHub literally.
# shellcheck disable=SC2016
gh api graphql -f query=' gh api graphql -f query='
query($org: String!, $number: Int!) { query($org: String!, $number: Int!) {
organization(login: $org){ organization(login: $org){
@@ -60,29 +48,19 @@ jobs:
} }
} }
} }
}' -f org="$ORGANIZATION" -F number="$PROJECT_NUMBER" > project_data.json }' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
# Parse project data # Parse project data
PROJECT_ID=$(jq -er '.data.organization.projectV2.id' project_data.json) cat >> "$GITHUB_ENV" <<EOF
PLUGIN_FIELD_ID=$(jq -er '.data.organization.projectV2.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json) PROJECT_ID=$(jq '.data.organization.projectV2.id' project_data.json)
THEME_FIELD_ID=$(jq -er '.data.organization.projectV2.fields.nodes[] | select(.name == "Theme") | .id' project_data.json) PLUGIN_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json)
for id in "$PROJECT_ID" "$PLUGIN_FIELD_ID" "$THEME_FIELD_ID"; do THEME_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Theme") | .id' project_data.json)
[[ "$id" =~ ^[A-Za-z0-9_=/+-]+$ ]] || exit 1 EOF
done
{
echo "PROJECT_ID=$PROJECT_ID"
echo "PLUGIN_FIELD_ID=$PLUGIN_FIELD_ID"
echo "THEME_FIELD_ID=$THEME_FIELD_ID"
} >> "$GITHUB_OUTPUT"
- name: Add to project - name: Add to project
id: item
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
ISSUE_OR_PR_ID: ${{ github.event.issue.node_id || github.event.pull_request.node_id }} ISSUE_OR_PR_ID: ${{ github.event.issue.node_id || github.event.pull_request.node_id }}
PROJECT_ID: ${{ steps.project.outputs.PROJECT_ID }}
run: | run: |
# GraphQL variables must reach GitHub literally.
# shellcheck disable=SC2016
item_id="$(gh api graphql -f query=' item_id="$(gh api graphql -f query='
mutation($project: ID!, $content: ID!) { mutation($project: ID!, $content: ID!) {
addProjectV2ItemById(input: {projectId: $project, contentId: $content}) { addProjectV2ItemById(input: {projectId: $project, contentId: $content}) {
@@ -91,12 +69,10 @@ jobs:
} }
} }
} }
' -f project="$PROJECT_ID" -f content="$ISSUE_OR_PR_ID" --jq '.data.addProjectV2ItemById.item.id // error("missing project item ID")')" ' -f project="$PROJECT_ID" -f content="$ISSUE_OR_PR_ID" --jq '.data.addProjectV2ItemById.item.id')"
[[ "$item_id" =~ ^[A-Za-z0-9_=/+-]+$ ]] || exit 1 echo "ITEM_ID=$item_id" >> $GITHUB_ENV
echo "ITEM_ID=$item_id" >> "$GITHUB_OUTPUT"
- name: Classify Pull Request - name: Classify Pull Request
id: classify
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
@@ -133,20 +109,12 @@ jobs:
print "THEME=" theme print "THEME=" theme
} }
} }
' >> "$GITHUB_OUTPUT" ' >> "$GITHUB_ENV"
- name: Fill Pull Request fields in project - name: Fill Pull Request fields in project
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
env: env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }} GH_TOKEN: ${{ steps.generate-token.outputs.token }}
PROJECT_ID: ${{ steps.project.outputs.PROJECT_ID }}
ITEM_ID: ${{ steps.item.outputs.ITEM_ID }}
PLUGIN_FIELD_ID: ${{ steps.project.outputs.PLUGIN_FIELD_ID }}
PLUGIN: ${{ steps.classify.outputs.PLUGIN }}
THEME_FIELD_ID: ${{ steps.project.outputs.THEME_FIELD_ID }}
THEME: ${{ steps.classify.outputs.THEME }}
run: | run: |
# GraphQL variables must reach GitHub literally.
# shellcheck disable=SC2016
gh api graphql -f query=' gh api graphql -f query='
mutation ( mutation (
$project: ID! $project: ID!
+2 -7
View File
@@ -14,18 +14,13 @@ on:
push: push:
branches: ["master"] branches: ["master"]
concurrency: # Declare default permissions as read only.
group: ${{ github.workflow }}-${{ github.ref }} permissions: read-all
cancel-in-progress: true
# Permissions are granted only to the analysis job.
permissions: {}
jobs: jobs:
analysis: analysis:
name: Scorecard analysis name: Scorecard analysis
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15
permissions: permissions:
# Needed to upload the results to code-scanning dashboard. # Needed to upload the results to code-scanning dashboard.
security-events: write security-events: write
+16 -10
View File
@@ -295,17 +295,23 @@ function _omz::plugin::disable {
fi fi
# Remove plugins substitution awk script # Remove plugins substitution awk script
# A match consumes the whitespace around the plugin, so adjacent plugins
# can't match in the same pass: repeat until the line stops changing.
local awk_subst_plugins="\ local awk_subst_plugins="\
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after do {
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL prev = \$0
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
} while (\$0 != prev)
" "
# Disable plugins awk script # Disable plugins awk script
@@ -392,8 +398,8 @@ function _omz::plugin::enable {
# Enable plugins awk script # Enable plugins awk script
local awk_script=" local awk_script="
# if plugins=() is in oneline form, substitute ) with new plugins and go to the next line # if plugins=() is in oneline form (empty or not), substitute ) with new plugins and go to the next line
/^[ \t]*plugins=\([^#]+\).*\$/ { /^[ \t]*plugins=\([^#]*\).*\$/ {
sub(/\)/, \" $add_plugins&\") sub(/\)/, \" $add_plugins&\")
print \$0 print \$0
next next
+27
View File
@@ -16,6 +16,10 @@
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/ # - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
# - win32yank (Windows) # - win32yank (Windows)
# - tmux (if $TMUX is set) # - tmux (if $TMUX is set)
# - OSC 52 (when no clipboard tool is available, e.g. over SSH or in a container)
#
# Set ZSH_CLIPBOARD_OSC52 to "always" to copy through OSC 52 even if a
# clipboard tool is available, or to "never" to disable the fallback.
# #
# Defines two functions, clipcopy and clippaste, based on the detected platform. # Defines two functions, clipcopy and clippaste, based on the detected platform.
## ##
@@ -48,6 +52,22 @@
# # Paste to a file # # Paste to a file
# clippaste > file.txt # clippaste > file.txt
# #
function _has_osc52_clipboard() {
[[ -n "${TTY:-}" ]] && [[ -w "${TTY}" ]] && (( ${+commands[base64]} ))
}
function _clipcopy_osc52() {
emulate -L zsh
local content
content=$(cat "${1:-/dev/stdin}" | base64 | tr -d '\n') || return 1
print -rn -- $'\e]52;c;'"${content}"$'\e\\' > /dev/tty
}
function _clippaste_osc52() {
print 'clippaste: OSC 52 is write-only and no other clipboard tool was found' >&2
return 1
}
function detect-clipboard() { function detect-clipboard() {
emulate -L zsh emulate -L zsh
@@ -87,6 +107,9 @@ function detect-clipboard() {
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
function clipcopy() { tmux load-buffer -w "${1:--}"; } function clipcopy() { tmux load-buffer -w "${1:--}"; }
function clippaste() { tmux save-buffer -; } function clippaste() { tmux save-buffer -; }
elif [[ "${ZSH_CLIPBOARD_OSC52:-}" != never ]] && _has_osc52_clipboard; then
function clipcopy() { _clipcopy_osc52 "$@"; }
function clippaste() { _clippaste_osc52; }
else else
function _retry_clipboard_detection_or_fail() { function _retry_clipboard_detection_or_fail() {
local clipcmd="${1}"; shift local clipcmd="${1}"; shift
@@ -101,6 +124,10 @@ function detect-clipboard() {
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; } function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
return 1 return 1
fi fi
if [[ "${ZSH_CLIPBOARD_OSC52:-}" == always ]] && _has_osc52_clipboard; then
function clipcopy() { _clipcopy_osc52 "$@"; }
fi
} }
function clipcopy clippaste { function clipcopy clippaste {
+43 -8
View File
@@ -7,16 +7,20 @@ run_awk() {
(( ! DEBUG )) || set -xv (( ! DEBUG )) || set -xv
local awk_subst_plugins="\ local awk_subst_plugins="\
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after do {
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL prev = \$0
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
} while (\$0 != prev)
" "
# Disable plugins awk script # Disable plugins awk script
local awk_script=" local awk_script="
@@ -167,3 +171,34 @@ z)" \
"plugins=( "plugins=(
git git
)" )"
run_awk_and_test \
"it should delete two adjacent plugins among others in oneline format" \
"docker kubectl" \
"plugins=(git docker kubectl npm)" \
"plugins=(git npm)"
run_awk_and_test \
"it should delete three adjacent plugins among others in oneline format" \
"docker kubectl aws" \
"plugins=(git docker kubectl aws npm)" \
"plugins=(git npm)"
run_awk_and_test \
"it should delete every plugin of a long oneline list" \
"git docker kubectl aws npm z" \
"plugins=(git docker kubectl aws npm z)" \
"plugins=()"
run_awk_and_test \
"it should delete adjacent plugins sharing a line in multiline format" \
"docker kubectl aws" \
"plugins=(
git
docker kubectl aws
npm
)" \
"plugins=(
git
npm
)"
+1 -1
View File
@@ -59,7 +59,7 @@ ensures the `bdr` alias runs without warnings.
| `bsra` | `bsr --all` | Run all stopped services. | | `bsra` | `bsr --all` | Run all stopped services. |
| `bu` | `brew update` | Update brew and all installed formulae. | | `bu` | `brew update` | Update brew and all installed formulae. |
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. | | `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
| `bubu` | `bubo && bup` | Do the last two operations above. | | `bubu` | `bu && bup` | Update Homebrew data, then upgrade outdated, unpinned brews. |
| `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. | | `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
| `bup` | `brew upgrade` | Upgrade outdated, unpinned brews. | | `bup` | `brew upgrade` | Upgrade outdated, unpinned brews. |
| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. | | `buz` | `brew uninstall --zap` | Remove all files associated with a cask. |
+1 -1
View File
@@ -75,7 +75,7 @@ alias bsr='brew services run'
alias bsra='bsr --all' alias bsra='bsr --all'
alias bu='brew update' alias bu='brew update'
alias bubo='brew update && brew outdated' alias bubo='brew update && brew outdated'
alias bubu='bubo && bup' alias bubu='bu && bup'
alias bubug='bubo && bugbc' alias bubug='bubo && bugbc'
alias bugbc='brew upgrade --greedy && brew cleanup' alias bugbc='brew upgrade --greedy && brew cleanup'
alias bup='brew upgrade' alias bup='brew upgrade'
+1
View File
@@ -90,6 +90,7 @@ colorize_less() {
# (e.g. when not scrolled to the bottom) while already the next file will be displayed. # (e.g. when not scrolled to the bottom) while already the next file will be displayed.
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \ local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \ ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
ZSH_COLORIZE_CHROMA_FORMATTER=$ZSH_COLORIZE_CHROMA_FORMATTER \
colorize_cat %s 2> /dev/null'" colorize_cat %s 2> /dev/null'"
# LESSCLOSE will be set to prevent any errors by executing a user script # LESSCLOSE will be set to prevent any errors by executing a user script
+11 -3
View File
@@ -1,6 +1,6 @@
# conda plugin # conda plugin
The conda plugin provides [aliases](#aliases) for `conda`, usually installed via [anaconda](https://www.anaconda.com/) or [miniconda](https://docs.conda.io/en/latest/miniconda.html). The conda plugin provides [aliases](#aliases) and [completion](#completion) for `conda`, usually installed via [anaconda](https://www.anaconda.com/) or [miniconda](https://docs.conda.io/en/latest/miniconda.html).
To use it, add `conda` to the plugins array in your zshrc file: To use it, add `conda` to the plugins array in your zshrc file:
@@ -28,10 +28,18 @@ plugins=(... conda)
| `cnle` | `conda list --export` | Export the list of installed packages in the current environment | | `cnle` | `conda list --export` | Export the list of installed packages in the current environment |
| `cnles` | `conda list --explicit > spec-file.txt` | Export the list of installed packages in the current environment to a spec file | | `cnles` | `conda list --explicit > spec-file.txt` | Export the list of installed packages in the current environment to a spec file |
| `cnr` | `conda remove` | Remove given package | | `cnr` | `conda remove` | Remove given package |
| `cnrn` | `conda remove -y -all -n` | Remove all packages in the specified environment | | `cnrn` | `conda remove -y --all -n` | Remove all packages in the specified environment |
| `cnrp` | `conda remove -y -all -p` | Remove all packages in the specified prefix | | `cnrp` | `conda remove -y --all -p` | Remove all packages in the specified prefix |
| `cnry` | `conda remove -y` | Remove given package without confirmation | | `cnry` | `conda remove -y` | Remove given package without confirmation |
| `cnsr` | `conda search` | Search conda repositories for package | | `cnsr` | `conda search` | Search conda repositories for package |
| `cnu` | `conda update` | Update conda package manager | | `cnu` | `conda update` | Update conda package manager |
| `cnua` | `conda update --all` | Update all installed packages | | `cnua` | `conda update --all` | Update all installed packages |
| `cnuc` | `conda update conda` | Update conda package manager | | `cnuc` | `conda update conda` | Update conda package manager |
## Completion
Tab completion is available for the following commands, using the environment list conda keeps in
`~/.conda/environments.txt`:
- `cna`: completes environment names for `conda activate`
- `cnrn`: completes environment names for `conda remove -y --all -n`
+21 -2
View File
@@ -1,4 +1,7 @@
alias cna='conda activate' unalias cna cnrn 2>/dev/null
cna() { conda activate "$@"; }
cnrn() { conda remove -y --all -n "$@"; }
alias cnab='conda activate base' alias cnab='conda activate base'
alias cncf='conda env create -f' alias cncf='conda env create -f'
alias cncn='conda create -y -n' alias cncn='conda create -y -n'
@@ -14,10 +17,26 @@ alias cnl='conda list'
alias cnle='conda list --export' alias cnle='conda list --export'
alias cnles='conda list --explicit > spec-file.txt' alias cnles='conda list --explicit > spec-file.txt'
alias cnr='conda remove' alias cnr='conda remove'
alias cnrn='conda remove -y --all -n'
alias cnrp='conda remove -y --all -p' alias cnrp='conda remove -y --all -p'
alias cnry='conda remove -y' alias cnry='conda remove -y'
alias cnsr='conda search' alias cnsr='conda search'
alias cnu='conda update' alias cnu='conda update'
alias cnua='conda update --all' alias cnua='conda update --all'
alias cnuc='conda update conda' alias cnuc='conda update conda'
_omz_conda_envs() {
emulate -L zsh -o extended_glob
local envs_file="$HOME/.conda/environments.txt"
[[ -r "$envs_file" ]] || return 1
# Each line is an env prefix; named envs live under <dir>/envs/<name>.
# The root prefix (base) and envs created with -p have no name and are skipped.
local -aU envs
envs=(${(f)"$(<$envs_file)"})
envs=(${${(M)envs:#*/envs/[^/]##}:t})
(( ${#envs} )) && compadd -Q -a envs
}
if (( $+functions[compdef] )); then
compdef _omz_conda_envs cna cnrn
fi
+2 -2
View File
@@ -263,9 +263,9 @@ _dotenv_check_syntax() {
local filename="$1" local filename="$1"
if (( $# == 2 )); then if (( $# == 2 )); then
printf '%s' "$2" | zsh -fn /dev/stdin printf '%s' "$2" | command zsh -fn /dev/stdin
else else
zsh -fn -- "$filename" command zsh -fn -- "$filename"
fi || { fi || {
echo "dotenv: error when sourcing '$filename' file" >&2 echo "dotenv: error when sourcing '$filename' file" >&2
return 1 return 1
+3
View File
@@ -45,9 +45,12 @@ plugins=(... extract)
| `tar.lrz` | Tarball with lrzip compression | | `tar.lrz` | Tarball with lrzip compression |
| `tar.lz` | Tarball with lzip compression | | `tar.lz` | Tarball with lzip compression |
| `tar.lz4` | Tarball with lz4 compression | | `tar.lz4` | Tarball with lz4 compression |
| `tar.lzma` | Tarball with lzma compression |
| `tar.xz` | Tarball with lzma2 compression | | `tar.xz` | Tarball with lzma2 compression |
| `tar.zma` | Tarball with lzma compression | | `tar.zma` | Tarball with lzma compression |
| `tar.zst` | Tarball with zstd compression | | `tar.zst` | Tarball with zstd compression |
| `tar.Z` | Tarball with compress (LZW) compression |
| `taz` | Tarball with compress (LZW) compression |
| `tbz` | Tarball with bzip compression | | `tbz` | Tarball with bzip compression |
| `tbz2` | Tarball with bzip2 compression | | `tbz2` | Tarball with bzip2 compression |
| `tgz` | Tarball with gzip compression | | `tgz` | Tarball with gzip compression |
+1
View File
@@ -31,6 +31,7 @@ local -a exts=(
tar.lrz tar.lrz
tar.lz tar.lz
tar.lz4 tar.lz4
tar.lzma
tar.xz tar.xz
tar.zma tar.zma
tar.zst tar.zst
+40 -4
View File
@@ -88,7 +88,7 @@ EOF
tar --xz --help &> /dev/null \ tar --xz --help &> /dev/null \
&& tar --xz -xvf "$full_path" \ && tar --xz -xvf "$full_path" \
|| xzcat "$full_path" | tar xvf - } ;; || xzcat "$full_path" | tar xvf - } ;;
(*.tar.zma|*.tlz) (*.tar.lzma|*.tar.zma|*.tlz)
tar --lzma --help &> /dev/null \ tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$full_path" \ && tar --lzma -xvf "$full_path" \
|| lzcat "$full_path" | tar xvf - ;; || lzcat "$full_path" | tar xvf - ;;
@@ -97,6 +97,11 @@ EOF
&& tar --zstd -xvf "$full_path" \ && tar --zstd -xvf "$full_path" \
|| zstdcat "$full_path" | tar xvf - ;; || zstdcat "$full_path" | tar xvf - ;;
(*.tar) tar xvf "$full_path" ;; (*.tar) tar xvf "$full_path" ;;
# `tar cf - dir | compress > dir.tar.Z`: the plain `.Z` arm below only decompresses the
# stream back to `dir.tar`, so the combined form has to untar it in one step. `.taz` is the
# historic name for the same file, next to `.tgz`/`.tbz`/`.tlz`/`.txz`/`.tzst`. Matching is
# on the lowercased name, so `.tar.Z` lands here too.
(*.tar.z|*.taz) uncompress -c "$full_path" | tar xvf - ;;
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;; (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;;
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;; (*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;; (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
@@ -135,9 +140,40 @@ EOF
(*.deb) (*.deb)
command mkdir -p "control" "data" command mkdir -p "control" "data"
ar vx "$full_path" > /dev/null ar vx "$full_path" > /dev/null
builtin cd -q control; extract ../control.tar.* local member= dest= failed=0
builtin cd -q ../data; extract ../data.tar.* for member in control.tar.* data.tar.*; do
builtin cd -q ..; command rm *.tar.* debian-binary ;; dest="${member%%.*}"
case "${member:l}" in
(*.tar.gz)
(( $+commands[pigz] )) && { tar -I pigz -xvf "$member" -C "$dest" } \
|| tar zxvf "$member" -C "$dest" ;;
(*.tar.bz2)
(( $+commands[pbzip2] )) && { tar -I pbzip2 -xvf "$member" -C "$dest" } \
|| tar xvjf "$member" -C "$dest" ;;
(*.tar.xz)
# .deb members are small, so skip extract()'s pixz fast path and
# let tar use its built-in xz support (or a plain pipe).
tar --xz --help &> /dev/null \
&& tar --xz -xvf "$member" -C "$dest" \
|| xzcat "$member" | tar xvf - -C "$dest" ;;
(*.tar.zst)
tar --zstd --help &> /dev/null \
&& tar --zstd -xvf "$member" -C "$dest" \
|| zstdcat "$member" | tar xvf - -C "$dest" ;;
(*.tar)
tar xvf "$member" -C "$dest" ;;
(*)
echo "extract: cannot extract unexpected .deb member '$member'" >&2
failed=1
success=1 ;;
esac
done
if (( failed )); then
# Keep the archive members so the unexpected one can be inspected.
echo "extract: leaving .deb members in place" >&2
else
command rm *.tar.* debian-binary
fi ;;
(*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;; (*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
(*.cab|*.exe) cabextract "$full_path" ;; (*.cab|*.exe) cabextract "$full_path" ;;
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;; (*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
+125 -2
View File
@@ -4,7 +4,7 @@
emulate -L zsh emulate -L zsh
setopt err_return setopt err_return
for tool in lzma unlzma uncompress; do for tool in ar lzma unlzma uncompress; do
(( $+commands[$tool] )) || { (( $+commands[$tool] )) || {
print -u2 -r -- "These tests require $tool." print -u2 -r -- "These tests require $tool."
exit 1 exit 1
@@ -46,6 +46,120 @@ check_extract() {
print -r -- "PASS: $extension ($mode)" print -r -- "PASS: $extension ($mode)"
} }
# Extracting a .deb must place the control members directly in <name>/control
# and the data members directly in <name>/data, whatever their member count.
check_deb_extract() {
local mode=$1
local case_dir="$test_dir/deb-$mode"
mkdir -p "$case_dir/source files" "$case_dir/work/target dir" \
"$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "conf:1" > "$case_dir/src/ctl/conffiles"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" conffiles postinst
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
rm -f "$case_dir/source files/pkg.deb"
ar rS "$case_dir/source files/pkg.deb" debian-binary control.tar.gz data.tar.gz
)
local archive="$case_dir/source files/pkg.deb"
builtin cd "$case_dir/work"
local base="$PWD/pkg"
local -a args
case "$mode" in
target)
args=(-t 'target dir')
base="$PWD/target dir/pkg"
;;
remove) args=(-r) ;;
esac
() {
emulate -L zsh
extract "${args[@]}" "$archive"
} || return 1
[[ -f "$base/control/conffiles" && -f "$base/control/postinst" ]] ||
{ print -u2 -r -- "$mode: control members not extracted into $base/control"; return 1 }
[[ -f "$base/data/usr/bin/app" ]] ||
{ print -u2 -r -- "$mode: data members not extracted into $base/data"; return 1 }
[[ ! -d "$base/control/control" && ! -d "$base/data/data" ]] ||
{ print -u2 -r -- "$mode: deb extraction double-nested the member directories"; return 1 }
[[ ! -e "$base/control.tar.gz" && ! -e "$base/data.tar.gz" && ! -e "$base/debian-binary" ]] ||
{ print -u2 -r -- "$mode: deb member debris left behind"; return 1 }
if [[ $mode == remove ]]; then
[[ ! -e $archive ]]
else
[[ -f $archive ]]
fi
print -r -- "PASS: deb ($mode)"
}
# An unexpected member must be reported and left on disk for inspection, and
# the cleanup must not delete the other members around it either.
check_deb_unexpected_member() {
local case_dir="$test_dir/deb-unexpected"
mkdir -p "$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" postinst
print -r -- "unknown compression" > "$case_dir/src/control.tar.weird"
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
ar rS "$case_dir/pkg.deb" debian-binary control.tar.weird data.tar.gz
)
builtin cd "$case_dir"
() {
emulate -L zsh
extract "$case_dir/pkg.deb"
} || return 1
[[ -f "$case_dir/pkg/data/usr/bin/app" ]] ||
{ print -u2 -r -- "deb-unexpected: known members were not extracted"; return 1 }
[[ -f "$case_dir/pkg/control.tar.weird" && -f "$case_dir/pkg/data.tar.gz" &&
-f "$case_dir/pkg/debian-binary" ]] ||
{ print -u2 -r -- "deb-unexpected: archive members were deleted"; return 1 }
print -r -- "PASS: deb (unexpected member)"
}
# Passing more than one .deb in a single call must not leak the loop variables
# between archives; the stale `member`/`dest` locals used to be printed by the
# second archive.
check_deb_multiple() {
local case_dir="$test_dir/deb-multiple"
mkdir -p "$case_dir/src/ctl" "$case_dir/src/data/usr/bin"
print -r -- "postinst script" > "$case_dir/src/ctl/postinst"
print -r -- "app main" > "$case_dir/src/data/usr/bin/app"
tar czf "$case_dir/src/control.tar.gz" -C "$case_dir/src/ctl" postinst
tar czf "$case_dir/src/data.tar.gz" -C "$case_dir/src/data" usr
print -r -- "2.0" > "$case_dir/src/debian-binary"
(
builtin cd "$case_dir/src"
ar rS "$case_dir/one.deb" debian-binary control.tar.gz data.tar.gz
ar rS "$case_dir/two.deb" debian-binary control.tar.gz data.tar.gz
)
builtin cd "$case_dir"
local output
output=$( () {
emulate -L zsh
extract one.deb two.deb
} 2>&1 ) || return 1
[[ $output != *member=* && $output != *dest=* ]] ||
{ print -u2 -r -- "deb-multiple: stale loop variables were printed"; return 1 }
[[ -f one/control/postinst && -f one/data/usr/bin/app &&
-f two/control/postinst && -f two/data/usr/bin/app ]] ||
{ print -u2 -r -- "deb-multiple: both archives were not extracted"; return 1 }
print -r -- "PASS: deb (multiple archives)"
}
{ {
print -r -- hello > "$test_dir/plain" print -r -- hello > "$test_dir/plain"
lzma -c "$test_dir/plain" > "$test_dir/fixture.lzma" lzma -c "$test_dir/plain" > "$test_dir/fixture.lzma"
@@ -53,11 +167,20 @@ check_extract() {
printf '\037\235\220\150\312\260\141\363\106\001' \ printf '\037\235\220\150\312\260\141\363\106\001' \
> "$test_dir/fixture.Z" > "$test_dir/fixture.Z"
for extension in lzma Z; do cp "$test_dir/plain" "$test_dir/sample.txt"
tar -cf "$test_dir/fixture.tar" -C "$test_dir" sample.txt
lzma -c "$test_dir/fixture.tar" > "$test_dir/fixture.tar.lzma"
for extension in lzma Z tar.lzma; do
for mode in default target remove; do for mode in default target remove; do
check_extract "$extension" "$mode" check_extract "$extension" "$mode"
done done
done done
check_deb_extract default
check_deb_extract target
check_deb_extract remove
check_deb_unexpected_member
check_deb_multiple
print 'All extract compressed-file tests passed.' print 'All extract compressed-file tests passed.'
} always { } always {
builtin cd "$original_dir" builtin cd "$original_dir"
+18
View File
@@ -0,0 +1,18 @@
# Fizzy CLI plugin
This plugin adds completion for the [Fizzy CLI (fizzy)](https://github.com/basecamp/fizzy-cli).
To use it, add `fizzy` to the plugins array in your zshrc file:
```zsh
plugins=(... fizzy)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script and automatically updates it when the
plugin is loaded, which is usually when you start a new terminal emulator.
The cache is stored at `$ZSH_CACHE_DIR/completions/_fizzy`.
+24
View File
@@ -0,0 +1,24 @@
# Autocompletion for the Fizzy CLI (fizzy).
if (( ! $+commands[fizzy] )); then
return
fi
# If the completion isn't registered yet, autoload it and bind it to `fizzy`.
# Otherwise, compinit will have already done that from the cache.
if [[ -z ${_comps[fizzy]-} ]]; then
typeset -g -A _comps
autoload -Uz _fizzy
_comps[fizzy]=_fizzy
fi
zmodload -F zsh/files b:zf_mv || return
() {
local cache_file="$ZSH_CACHE_DIR/completions/_fizzy"
local temp_file
temp_file=$(mktemp "$ZSH_CACHE_DIR/completions/._fizzy.XXXXXXXX") || return
if command fizzy completion zsh >| "$temp_file" && [[ -s "$temp_file" ]] &&
zf_mv -f -- "$temp_file" "$cache_file"; then
return
fi
rm -f -- "$temp_file"
} &|
+15
View File
@@ -0,0 +1,15 @@
# fnox
Adds shell integration and completions for [fnox](https://github.com/jdx/fnox), a tool for provider-agnostic secret injection.
## Installation
[Install fnox](https://fnox.jdx.dev/guide/quick-start.html), then add it to your plugins in `~/.zshrc`:
```zsh
plugins=(fnox)
```
## Usage
See the [fnox documentation](https://fnox.jdx.dev/guide/shell-integration.html) for shell integration and usage.
+23
View File
@@ -0,0 +1,23 @@
if (( ! $+commands[fnox] )); then
# if we don't have fnox at all just bail out
return
fi
eval "$(fnox activate zsh)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `fnox`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_fnox" ]]; then
typeset -g -A _comps
autoload -Uz _fnox
_comps[fnox]=_fnox
fi
# Regenerate completions when the executable changes.
if [[ ! -s "$ZSH_CACHE_DIR/completions/_fnox" || "$commands[fnox]" -nt "$ZSH_CACHE_DIR/completions/_fnox" ]]; then
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._fnox"
zf_mv -f -- =( fnox completion zsh ) "$ZSH_CACHE_DIR/completions/_fnox"
} &|
fi
+6 -2
View File
@@ -12,7 +12,7 @@ plugins=(... git-commit)
## Syntax ## Syntax
```zsh ```zsh
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] "<message>" git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] [(-b, --body) "<body>"] "<message>"
``` ```
Where `type` is one of the following: Where `type` is one of the following:
@@ -30,6 +30,9 @@ Where `type` is one of the following:
- `test` - `test`
- `wip` - `wip`
The optional `-b` / `--body` becomes the commit body (a blank line after the subject), as defined by
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary).
> NOTE: the subcommand for `revert` type is `rev`, as otherwise it conflicts with the > NOTE: the subcommand for `revert` type is `rev`, as otherwise it conflicts with the
> git command of the same name. It will still generate a commit message in the format > git command of the same name. It will still generate a commit message in the format
> `revert: <message>` > `revert: <message>`
@@ -39,6 +42,7 @@ Where `type` is one of the following:
| Git subcommand | Command | | Git subcommand | Command |
| --------------------------------------------- | ---------------------------------------------------- | | --------------------------------------------- | ---------------------------------------------------- |
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` | | `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
| `git wip "work in progress"` | `git commit -m "work in progress"` | | `git wip "work in progress"` | `git commit -m "wip: work in progress"` |
| `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` | | `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` |
| `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` | | `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` |
| `git feat -s "auth" -b "Keep session across redirects." "add login redirect"` | `git commit -m "feat(auth): add login redirect" -m "Keep session across redirects."` |
+11 -3
View File
@@ -12,11 +12,11 @@ _omz_git_commit() {
if [[ "$_type" == rev ]]; then if [[ "$_type" == rev ]]; then
_type=revert _type=revert
fi fi
local _scope _attention _message local _scope _attention _message _body
while [ $# -ne 0 ]; do while [ $# -ne 0 ]; do
case $1 in case $1 in
-s | --scope ) -s | --scope )
if [ -z $2 ]; then if [ -z "$2" ]; then
echo >&2 "Missing scope!" echo >&2 "Missing scope!"
return 1 return 1
fi fi
@@ -27,12 +27,20 @@ _omz_git_commit() {
_attention="!" _attention="!"
shift 1 shift 1
;; ;;
-b | --body )
if [ -z "$2" ]; then
echo >&2 "Missing body!"
return 1
fi
_body="$2"
shift 2
;;
* ) * )
_message="${_message} $1" _message="${_message} $1"
shift 1 shift 1
;; ;;
esac esac
done done
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}" git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}" ${_body:+-m} ${_body:+"$_body"}
} }
_omz_git_commit "$@" _omz_git_commit "$@"
+2 -1
View File
@@ -21,7 +21,7 @@ plugins=(... git)
| `gapa` | `git add --patch` | | `gapa` | `git add --patch` |
| `gau` | `git add --update` | | `gau` | `git add --update` |
| `gav` | `git add --verbose` | | `gav` | `git add --verbose` |
| `gwip` | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` | | `gwip` | `git add -A; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` |
| `gam` | `git am` | | `gam` | `git am` |
| `gama` | `git am --abort` | | `gama` | `git am --abort` |
| `gamc` | `git am --continue` | | `gamc` | `git am --continue` |
@@ -208,6 +208,7 @@ plugins=(... git)
| `gsb` | `git status --short -b` | | `gsb` | `git status --short -b` |
| `gsnut` | `git status --untracked-files=no` | | `gsnut` | `git status --untracked-files=no` |
| `gsi` | `git submodule init` | | `gsi` | `git submodule init` |
| `gsms` | `git submodule status` |
| `gsu` | `git submodule update` | | `gsu` | `git submodule update` |
| `gsuri` | `git submodule update --recursive --init` | | `gsuri` | `git submodule update --recursive --init` |
| `gsd` | `git svn dcommit` | | `gsd` | `git svn dcommit` |
+2 -1
View File
@@ -119,7 +119,7 @@ alias gaa='git add --all'
alias gapa='git add --patch' alias gapa='git add --patch'
alias gau='git add --update' alias gau='git add --update'
alias gav='git add --verbose' alias gav='git add --verbose'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"' alias gwip='git add -A; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
alias gam='git am' alias gam='git am'
alias gama='git am --abort' alias gama='git am --abort'
alias gamc='git am --continue' alias gamc='git am --continue'
@@ -410,6 +410,7 @@ alias gss='git status --short'
alias gsb='git status --short --branch' alias gsb='git status --short --branch'
alias gsnut='git status --untracked-files=no' alias gsnut='git status --untracked-files=no'
alias gsi='git submodule init' alias gsi='git submodule init'
alias gsms='git submodule status'
alias gsu='git submodule update' alias gsu='git submodule update'
alias gsuri='git submodule update --recursive --init' alias gsuri='git submodule update --recursive --init'
alias gsd='git svn dcommit' alias gsd='git svn dcommit'
+17 -4
View File
@@ -1,5 +1,18 @@
# Autocompletion for invoke. # Autocompletion for the Invoke CLI (invoke).
# if (( ! $+commands[invoke] )); then
if [ $commands[invoke] ]; then return
source <(invoke --print-completion-script=zsh) fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_invoke" ]]; then
invoke --print-completion-script=zsh | tee "$ZSH_CACHE_DIR/completions/_invoke" >/dev/null
source "$ZSH_CACHE_DIR/completions/_invoke"
else
source "$ZSH_CACHE_DIR/completions/_invoke"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._invoke"
zf_mv -f -- =( invoke --print-completion-script=zsh ) "$ZSH_CACHE_DIR/completions/_invoke"
} &|
fi fi
+17 -3
View File
@@ -1,4 +1,18 @@
if [ $commands[istioctl] ]; then # Autocompletion for the Istio CLI (istioctl).
source <(istioctl completion zsh) if (( ! $+commands[istioctl] )); then
compdef _istioctl istioctl return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_istioctl" ]]; then
istioctl completion zsh | tee "$ZSH_CACHE_DIR/completions/_istioctl" >/dev/null
source "$ZSH_CACHE_DIR/completions/_istioctl"
else
source "$ZSH_CACHE_DIR/completions/_istioctl"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._istioctl"
zf_mv -f -- =( istioctl completion zsh ) "$ZSH_CACHE_DIR/completions/_istioctl"
} &|
fi fi
+1
View File
@@ -44,6 +44,7 @@ plugins=(... jj)
| jjgi | `jj git init` | | jjgi | `jj git init` |
| jjgp | `jj git push` | | jjgp | `jj git push` |
| jjgpa | `jj git push --all` | | jjgpa | `jj git push --all` |
| jjgpb | `jj git push --bookmark` |
| jjgpd | `jj git push --deleted` | | jjgpd | `jj git push --deleted` |
| jjgpt | `jj git push --tracked` | | jjgpt | `jj git push --tracked` |
| jjgrl | `jj git remote list` | | jjgrl | `jj git remote list` |
+1
View File
@@ -70,6 +70,7 @@ alias jjgfa='jj git fetch --all-remotes'
alias jjgi='jj git init' alias jjgi='jj git init'
alias jjgp='jj git push' alias jjgp='jj git push'
alias jjgpa='jj git push --all' alias jjgpa='jj git push --all'
alias jjgpb='jj git push --bookmark'
alias jjgpd='jj git push --deleted' alias jjgpd='jj git push --deleted'
alias jjgpt='jj git push --tracked' alias jjgpt='jj git push --tracked'
alias jjgrl='jj git remote list' alias jjgrl='jj git remote list'
+17 -4
View File
@@ -1,8 +1,21 @@
# Autocompletion for kn, the command line interface for knative # Autocompletion for kn, the command line interface for Knative.
# #
# Author: https://github.com/btannous # Author: https://github.com/btannous
if [ $commands[kn] ]; then if (( ! $+commands[kn] )); then
source <(kn completion zsh) return
compdef _kn kn fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_kn" ]]; then
kn completion zsh | tee "$ZSH_CACHE_DIR/completions/_kn" >/dev/null
source "$ZSH_CACHE_DIR/completions/_kn"
else
source "$ZSH_CACHE_DIR/completions/_kn"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kn"
zf_mv -f -- =( kn completion zsh ) "$ZSH_CACHE_DIR/completions/_kn"
} &|
fi fi
+17 -2
View File
@@ -1,3 +1,18 @@
if [ $commands[kompose] ]; then # Autocompletion for the Kompose CLI (kompose).
source <(kompose completion zsh) if (( ! $+commands[kompose] )); then
return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_kompose" ]]; then
kompose completion zsh | tee "$ZSH_CACHE_DIR/completions/_kompose" >/dev/null
source "$ZSH_CACHE_DIR/completions/_kompose"
else
source "$ZSH_CACHE_DIR/completions/_kompose"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kompose"
zf_mv -f -- =( kompose completion zsh ) "$ZSH_CACHE_DIR/completions/_kompose"
} &|
fi fi
+17 -2
View File
@@ -1,3 +1,18 @@
if [ $commands[kops] ]; then # Autocompletion for the Kubernetes Operations CLI (kops).
source <(kops completion zsh) if (( ! $+commands[kops] )); then
return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_kops" ]]; then
kops completion zsh | tee "$ZSH_CACHE_DIR/completions/_kops" >/dev/null
source "$ZSH_CACHE_DIR/completions/_kops"
else
source "$ZSH_CACHE_DIR/completions/_kops"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kops"
zf_mv -f -- =( kops completion zsh ) "$ZSH_CACHE_DIR/completions/_kops"
} &|
fi fi
+58
View File
@@ -2,10 +2,44 @@
This plugin adds aliases and autocompletion for Laravel [Artisan](https://laravel.com/docs/artisan) and [Bob](http://daylerees.github.io/laravel-bob/) command-line interfaces. This plugin adds aliases and autocompletion for Laravel [Artisan](https://laravel.com/docs/artisan) and [Bob](http://daylerees.github.io/laravel-bob/) command-line interfaces.
It replaces the `laravel4` and `laravel5` plugins. Enable only `laravel` to use
the shared aliases and completion with Laravel projects of different versions.
``` ```
plugins=(... laravel) plugins=(... laravel)
``` ```
## Completion
For Laravel 4 and later, completion reads the available commands from
`artisan list --raw --no-ansi` in the current project, including custom commands.
The legacy static command-name completion is retained for Laravel 3, which does
not support that command. Artisan runs only when completing a command name;
command arguments use file completion without booting the application.
No Laravel command runs when the plugin is loaded.
## Migrating from laravel4 or laravel5
Replace `laravel4` or `laravel5` in your `plugins` array with `laravel`.
The old plugin names still load `laravel`, with a deprecation notice, and retain
their own version-specific aliases listed below. These aliases are available
only while the corresponding legacy plugin is enabled. When switching to
`laravel` alone, use `artisan` or the shared aliases instead; add any shortcuts
you still need to your own configuration.
| Alias | Command |
|-------|---------|
| `la4`, `la5` | `php artisan` |
| `la4dump` | `php artisan dump-autoload` |
| `la4cache`, `la5cache` | `php artisan cache:clear` |
| `la4routes` | `php artisan routes` (Laravel 4) |
| `la5routes` | `php artisan route:list` (Laravel 5 and later) |
| `la5vendor` | `php artisan vendor:publish` |
Only commands supported by your project's Laravel version can be run. The
version-specific aliases keep their original meaning; they do not translate
commands between versions.
## Settings ## Settings
By default the aliases run `php artisan`. To use a different PHP command, such as By default the aliases run `php artisan`. To use a different PHP command, such as
@@ -19,6 +53,16 @@ zstyle ':omz:plugins:laravel' php 'herd php'
`php` in the aliases below is then replaced with that command. `php` in the aliases below is then replaced with that command.
For a wrapper such as `herd php`, Zsh normally attempts completion for the
wrapper after expanding the alias. To complete `artisan`, `la4`, and `la5`
directly with this plugin instead, enable Zsh's `COMPLETE_ALIASES` option:
```zsh
setopt COMPLETE_ALIASES
```
This option applies to all aliases in your shell.
## Aliases ## Aliases
| Alias | Description | | Alias | Description |
@@ -80,3 +124,17 @@ zstyle ':omz:plugins:laravel' php 'herd php'
| `paqr` | `php artisan queue:retry` | | `paqr` | `php artisan queue:retry` |
| `paqt` | `php artisan queue:table` | | `paqt` | `php artisan queue:table` |
| `paqw` | `php artisan queue:work` | | `paqw` | `php artisan queue:work` |
## Modules
Aliases for [nWidart/laravel-modules](https://github.com/nWidart/laravel-modules).
| Alias | Description |
|:-:|:-:|
| `pamol` | `php artisan module:list` |
| `pamomk` | `php artisan module:make` |
| `pamoe` | `php artisan module:enable` |
| `pamod` | `php artisan module:disable` |
| `pamom` | `php artisan module:migrate` |
| `pamomr` | `php artisan module:migrate-rollback` |
| `pamos` | `php artisan module:seed` |
+20 -10
View File
@@ -8,6 +8,9 @@
# - Adds aliases and autocompletion for bob # - Adds aliases and autocompletion for bob
local curcontext="$curcontext" state line _opts _bundles ret=1 local curcontext="$curcontext" state line _opts _bundles ret=1
local php_command command_list
local -a artisan_commands
_arguments -C \ _arguments -C \
'1: :->cmds' \ '1: :->cmds' \
'*:: :->args' && ret=0 '*:: :->args' && ret=0
@@ -15,6 +18,21 @@ _arguments -C \
case $state in case $state in
cmds) cmds)
# Boot the application only to discover command names, not file arguments.
# Laravel 3 falls back to the static command names below.
zstyle -s ':omz:plugins:laravel' php php_command || php_command=php
if [[ -f artisan ]] && command_list=$(
"${(@Q)${(z)php_command}}" artisan list --raw --no-ansi 2>/dev/null
); then
artisan_commands=("${(@f)command_list}")
artisan_commands=(${artisan_commands[@]%%[[:space:]]*})
fi
if (( ${#artisan_commands} )); then
compadd -- "${artisan_commands[@]}"
return $?
fi
_values "Artisan command" \ _values "Artisan command" \
'session\:install[Create a session table]' \ 'session\:install[Create a session table]' \
'migrate[Manage Migrations]' \ 'migrate[Manage Migrations]' \
@@ -24,16 +42,8 @@ case $state in
ret=0 ret=0
;; ;;
args) args)
case $line[1] in _files
migrate) return $?
_values \
'install[Create the Laravel migration table' \
'make[Create a migration]' \
'rollback[Roll back to the last migration operation]' \
'reset[Roll back all migrations that have ever run]'
ret=0
;;
esac
;; ;;
esac esac
+16
View File
@@ -53,4 +53,20 @@ alias paqr="$_omz_laravel_php artisan queue:retry"
alias paqt="$_omz_laravel_php artisan queue:table" alias paqt="$_omz_laravel_php artisan queue:table"
alias paqw="$_omz_laravel_php artisan queue:work" alias paqw="$_omz_laravel_php artisan queue:work"
# Modules (nWidart/laravel-modules)
alias pamol="$_omz_laravel_php artisan module:list"
alias pamomk="$_omz_laravel_php artisan module:make"
alias pamoe="$_omz_laravel_php artisan module:enable"
alias pamod="$_omz_laravel_php artisan module:disable"
alias pamom="$_omz_laravel_php artisan module:migrate"
alias pamomr="$_omz_laravel_php artisan module:migrate-rollback"
alias pamos="$_omz_laravel_php artisan module:seed"
unset _omz_laravel_php unset _omz_laravel_php
# Also load completion when reached through a legacy plugin name.
if (( ! ${fpath[(Ie)${0:A:h}]} )); then
fpath+=("${0:A:h}")
fi
autoload -Uz _artisan
compdef _artisan artisan
+171
View File
@@ -0,0 +1,171 @@
#!/usr/bin/env zsh
# Run with: zsh -df plugins/laravel/tests/laravel.test.zsh
emulate -LR zsh
plugin_dir=${0:A:h:h}
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
typeset -i tests=0 failures=0 fixture_status=0
typeset completion_state=cmds fixture_output output
autoload -Uz compinit
compinit -D -u
# Record the interpreter's arguments even when invoked in a subshell.
php() {
print -rl -- "$@" >| "$test_dir/call"
print -r -- "$fixture_output"
return $fixture_status
}
check() {
local description=$1
shift
(( tests++ ))
if "$@"; then
print -r -- "PASS: $description"
else
print -u2 -r -- "FAIL: $description"
(( failures++ ))
fi
}
source "$plugin_dir/laravel.plugin.zsh"
check 'plugin loading does not execute PHP' test ! -e "$test_dir/call"
check 'completion is registered for artisan' \
test "${_comps[artisan]}" = _artisan
for name in la4 la4dump la4cache la4routes la5 la5cache la5routes la5vendor; do
check "laravel alone does not add $name" test "${+aliases[$name]}" = 0
done
for name in la4 la5; do
check "laravel alone does not register $name completion" \
test "${+_comps[$name]}" = 0
done
for entry in \
'pas:serve' 'pam:migrate' 'pamm:make:model' 'bob:bob::build'; do
name=${entry%%:*}
expected_command=${entry#*:}
expected_call=$'artisan\n'"$expected_command"$'\nargument with spaces'
eval "$name 'argument with spaces'" > /dev/null
check "$name preserves its command and arguments" \
test "$(command cat -- "$test_dir/call")" = "$expected_call"
done
# Exercise completion dispatch without requiring an interactive ZLE session.
_arguments() { state=$completion_state; line=(migrate); return 1; }
compadd() { [[ $1 == -- ]] && shift; print -rl -- "$@"; }
_values() { print -rl -- "$@"; }
_files() { print -r -- file-completion; }
mkdir "$test_dir/project with spaces"
builtin cd "$test_dir/project with spaces"
touch artisan
fixture_output='cache:clear Clear the application cache
migrate Run migrations
project:custom Run a custom command'
output=$(_artisan)
check 'project commands, namespaces and custom commands are completed' \
test "$output" = $'cache:clear\nmigrate\nproject:custom'
check 'completion uses the portable raw list interface' \
test "$(command cat -- "$test_dir/call")" = $'artisan\nlist\n--raw\n--no-ansi'
fixture_output='routes List Laravel 4 routes
dump-autoload Regenerate autoload files'
output=$(_artisan)
check 'Laravel 4 commands are discovered rather than hardcoded' \
test "$output" = $'routes\ndump-autoload'
completion_state=args
for fixture_status in 0 1; do
command rm -f -- "$test_dir/call"
output=$(_artisan)
check "command arguments use file completion (PHP status $fixture_status)" \
test "$output" = file-completion
check "argument completion never boots Artisan (PHP status $fixture_status)" \
test ! -e "$test_dir/call"
done
completion_state=cmds
fixture_status=1
fixture_output='Unsupported option: --raw'
output=$(_artisan)
check 'legacy Artisan retains its static completion when raw listing fails' \
test "${output[(f)-1]}" = 'key\:\:generate[Generate a key]'
fixture_status=0
fixture_output=''
output=$(_artisan)
check 'an empty command list falls back to legacy completion' \
test "${output[(f)-1]}" = 'key\:\:generate[Generate a key]'
command rm "$test_dir/call"
builtin cd "$test_dir"
output=$(_artisan)
check 'completion outside a project does not execute PHP' \
test ! -e "$test_dir/call"
# A configured command may contain multiple words and quoted arguments.
wrapper() {
print -rl -- "$@" >| "$test_dir/wrapper-call"
print -r -- "$fixture_output"
}
zstyle ':omz:plugins:laravel' php 'wrapper --site "site with spaces" php'
source "$plugin_dir/../laravel5/laravel5.plugin.zsh" 2> "$test_dir/warning"
eval 'la5routes "argument with spaces"' > /dev/null
expected_call=$'--site\nsite with spaces\nphp\nartisan\nroute:list'
expected_call+=$'\nargument with spaces'
check 'legacy aliases honor a configured PHP wrapper' \
test "$(command cat -- "$test_dir/wrapper-call")" = "$expected_call"
builtin cd "$test_dir/project with spaces"
fixture_output=$'project:custom Run a custom command'
output=$(_artisan)
expected_call=$'--site\nsite with spaces\nphp\nartisan\nlist\n--raw\n--no-ansi'
check 'completion honors a configured PHP wrapper' \
test "$(command cat -- "$test_dir/wrapper-call")" = "$expected_call"
check 'wrapper output is completed' test "$output" = project:custom
zstyle -d ':omz:plugins:laravel' php
for plugin in laravel4 laravel5; do
# Start a separate shell so no previously loaded completion can hide a
# missing autoload path in the compatibility plugin.
output=$(zsh -df -c '
autoload -Uz compinit
compinit -D -u
source "$1" 2> "$2"
prefix=la${3#laravel}
for name in artisan $prefix; do
[[ ${_comps[$name]} == _artisan ]] || exit 1
done
if [[ $prefix == la4 ]]; then
[[ ${+aliases[la5]} == 0 ]] || exit 1
expected_aliases=(
la4 "php artisan" la4dump "php artisan dump-autoload"
la4cache "php artisan cache:clear" la4routes "php artisan routes"
)
else
[[ ${+aliases[la4]} == 0 ]] || exit 1
expected_aliases=(
la5 "php artisan" la5cache "php artisan cache:clear"
la5routes "php artisan route:list"
la5vendor "php artisan vendor:publish"
)
fi
for name expected in "${expected_aliases[@]}"; do
[[ ${aliases[$name]} == "$expected" ]] || exit 1
done
autoload +X _artisan || exit 1
[[ ${functions_source[_artisan]} == */laravel/_artisan ]] || exit 1
print -r -- loaded
' zsh "$plugin_dir/../$plugin/$plugin.plugin.zsh" \
"$test_dir/warning" "$plugin")
result=$?
check "$plugin loads the unified completion and original aliases" \
test "$result:$output" = '0:loaded'
check "$plugin explains how to migrate" \
test "$(command cat -- "$test_dir/warning")" != ''
done
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
+7 -12
View File
@@ -1,18 +1,13 @@
# Laravel 4 plugin # Laravel 4 plugin
This plugin adds some aliases for common [Laravel 4](https://laravel.com/docs/4.2) commands. This plugin is deprecated. Use the [laravel plugin](../laravel) instead:
To use it, add `laravel4` to the plugins array in your zshrc file:
```zsh ```zsh
plugins=(... laravel4) plugins=(... laravel)
``` ```
## Aliases This compatibility loader sources `laravel` for shared aliases and completion,
then adds the original `la4`, `la4dump`, `la4cache`, and `la4routes` aliases.
| Alias | Command | Description | These version-specific aliases are only available while `laravel4` is enabled.
|-----------|-----------------------------|-------------------------------------| When switching to `laravel` alone, use `artisan` or the shared aliases, or define
| la4 | `php artisan` | Main Artisan command | any shortcuts you still need in your own configuration.
| la4dump | `php artisan dump-autoload` | Regenerate framework autoload files |
| la4cache | `php artisan cache:clear` | Flush the application cache |
| la4routes | `php artisan routes` | List all registered routes |
+12 -17
View File
@@ -1,20 +1,15 @@
# Laravel4 basic command completion print -Pru2 -- \
_laravel4_get_command_list () { '%F{yellow}[oh-my-zsh] The %Blaravel4%b plugin is deprecated.' \
php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }' 'Use %Blaravel%b instead.%f'
}
_laravel4 () { source "${0:A:h:h}/laravel/laravel.plugin.zsh"
if [ -f artisan ]; then
compadd `_laravel4_get_command_list`
fi
}
compdef _laravel4 artisan # Keep compatibility aliases scoped to users of this legacy plugin.
compdef _laravel4 la4 zstyle -s ':omz:plugins:laravel' php _omz_laravel_php || _omz_laravel_php=php
alias la4="$_omz_laravel_php artisan"
alias la4dump="$_omz_laravel_php artisan dump-autoload"
alias la4cache="$_omz_laravel_php artisan cache:clear"
alias la4routes="$_omz_laravel_php artisan routes"
unset _omz_laravel_php
#Alias compdef _artisan la4
alias la4='php artisan'
alias la4dump='php artisan dump-autoload'
alias la4cache='php artisan cache:clear'
alias la4routes='php artisan routes'
+7 -12
View File
@@ -1,18 +1,13 @@
# Laravel 5 plugin # Laravel 5 plugin
This plugin adds some aliases for common [Laravel 5](https://laravel.com/docs) commands. This plugin is deprecated. Use the [laravel plugin](../laravel) instead:
To use it, add `laravel5` to the plugins array in your zshrc file:
```zsh ```zsh
plugins=(... laravel5) plugins=(... laravel)
``` ```
## Aliases This compatibility loader sources `laravel` for shared aliases and completion,
then adds the original `la5`, `la5cache`, `la5routes`, and `la5vendor` aliases.
| Alias | Command | Description | These version-specific aliases are only available while `laravel5` is enabled.
|-----------|------------------------------|----------------------------------------------------| When switching to `laravel` alone, use `artisan` or the shared aliases, or define
| la5 | `php artisan` | Main Artisan command | any shortcuts you still need in your own configuration.
| la5cache | `php artisan cache:clear` | Flush the application cache |
| la5routes | `php artisan route:list` | List all registered routes |
| la5vendor | `php artisan vendor:publish` | Publish any publishable assets from vendor package |
+12 -16
View File
@@ -1,19 +1,15 @@
# Alias print -Pru2 -- \
alias la5='php artisan' '%F{yellow}[oh-my-zsh] The %Blaravel5%b plugin is deprecated.' \
alias la5cache='php artisan cache:clear' 'Use %Blaravel%b instead.%f'
alias la5routes='php artisan route:list'
alias la5vendor='php artisan vendor:publish'
# Laravel5 basic command completion source "${0:A:h:h}/laravel/laravel.plugin.zsh"
_laravel5_get_command_list () {
php artisan --raw --no-ansi list | sed "s/[[:space:]].*//g"
}
_laravel5 () { # Keep compatibility aliases scoped to users of this legacy plugin.
if [[ -f artisan ]]; then zstyle -s ':omz:plugins:laravel' php _omz_laravel_php || _omz_laravel_php=php
compadd $(_laravel5_get_command_list) alias la5="$_omz_laravel_php artisan"
fi alias la5cache="$_omz_laravel_php artisan cache:clear"
} alias la5routes="$_omz_laravel_php artisan route:list"
alias la5vendor="$_omz_laravel_php artisan vendor:publish"
unset _omz_laravel_php
compdef _laravel5 artisan compdef _artisan la5
compdef _laravel5 la5
+15 -12
View File
@@ -72,11 +72,6 @@ EOF
return 0 return 0
;; ;;
shuf|shuff|shuffle) shuf|shuff|shuffle)
# The shuffle property of current playlist can't be changed in iTunes 12,
# so this workaround uses AppleScript to simulate user input instead.
# Defaults to toggling when no options are given.
# The toggle option depends on the shuffle button being visible in the Now playing area.
# On and off use the menu bar items.
local state=$1 local state=$1
if [[ -n "$state" && "$state" != (on|off|toggle) ]]; then if [[ -n "$state" && "$state" != (on|off|toggle) ]]; then
@@ -85,16 +80,24 @@ EOF
fi fi
case "$state" in case "$state" in
on|off) # Inspired by: https://stackoverflow.com/a/43942013/2396771
# Inspired by: https://stackoverflow.com/a/14675583 on)
osascript >/dev/null 2>&1 <<EOF osascript -e "tell application \"$APP_NAME\" to set shuffle enabled to true";
tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" ) return 0
EOF ;;
off)
osascript -e "tell application \"$APP_NAME\" to set shuffle enabled to false";
return 0 return 0
;; ;;
toggle|*) toggle|*)
osascript >/dev/null 2>&1 <<EOF osascript 2>/dev/null <<EOF
tell application "System Events" to perform action "AXPress" of (button 2 of process "iTunes"'s window "iTunes"'s scroll area 1) tell application "$APP_NAME"
if shuffle enabled then
set shuffle enabled to false
else
set shuffle enabled to true
end
end tell
EOF EOF
return 0 return 0
;; ;;
+16 -3
View File
@@ -2,7 +2,20 @@
# #
# Author: https://github.com/kevinkirkup # Author: https://github.com/kevinkirkup
if [ $commands[oc] ]; then if (( ! $+commands[oc] )); then
source <(oc completion zsh) return
compdef _oc oc fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_oc" ]]; then
oc completion zsh | tee "$ZSH_CACHE_DIR/completions/_oc" >/dev/null
source "$ZSH_CACHE_DIR/completions/_oc"
else
source "$ZSH_CACHE_DIR/completions/_oc"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._oc"
zf_mv -f -- =( oc completion zsh ) "$ZSH_CACHE_DIR/completions/_oc"
} &|
fi fi
+17 -3
View File
@@ -1,4 +1,18 @@
if [ $commands[operator-sdk] ]; then # Autocompletion for the Operator SDK CLI (operator-sdk).
source <(operator-sdk completion zsh) if (( ! $+commands[operator-sdk] )); then
compdef _operator-sdk operator-sdk return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_operator-sdk" ]]; then
operator-sdk completion zsh | tee "$ZSH_CACHE_DIR/completions/_operator-sdk" >/dev/null
source "$ZSH_CACHE_DIR/completions/_operator-sdk"
else
source "$ZSH_CACHE_DIR/completions/_operator-sdk"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._operator-sdk"
zf_mv -f -- =( operator-sdk completion zsh ) "$ZSH_CACHE_DIR/completions/_operator-sdk"
} &|
fi fi
+17 -2
View File
@@ -1,5 +1,20 @@
if (( $+commands[plz] )); then # Autocompletion for the Please build system CLI (plz).
source <(plz --completion_script) if (( ! $+commands[plz] )); then
return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_plz" ]]; then
plz --completion_script | tee "$ZSH_CACHE_DIR/completions/_plz" >/dev/null
source "$ZSH_CACHE_DIR/completions/_plz"
else
source "$ZSH_CACHE_DIR/completions/_plz"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._plz"
zf_mv -f -- =( plz --completion_script ) "$ZSH_CACHE_DIR/completions/_plz"
} &|
fi fi
alias pb='plz build' alias pb='plz build'
+1 -1
View File
@@ -15,7 +15,7 @@ plugins=(... pre-commit)
| Alias | Command | Description | | Alias | Command | Description |
| ----- | ------------------------------------------------------ | --------------------------------------------- | | ----- | ------------------------------------------------------ | --------------------------------------------- |
| prc | `prek` or `pre-commit` | The pre-commit command | | prc | `prek` or `pre-commit` | The pre-commit command |
| prcau | `prek auto-update` or `pre-commit autoupdate` | Update hooks automatically | | prcau | `prek autoupdate` or `pre-commit autoupdate` | Update hooks automatically |
| prcr | `prek run` or `pre-commit run` | The pre-commit run command | | prcr | `prek run` or `pre-commit run` | The pre-commit run command |
| prcra | `prek run --all-files` or `pre-commit run --all-files` | Run pre-commit hooks on all files | | prcra | `prek run --all-files` or `pre-commit run --all-files` | Run pre-commit hooks on all files |
| prcrf | `prek run --files` or `pre-commit run --files` | Run pre-commit hooks on a given list of files | | prcrf | `prek run --files` or `pre-commit run --files` | Run pre-commit hooks on a given list of files |
+1 -3
View File
@@ -1,15 +1,13 @@
# Aliases for pre-commit (uses prek if available, else pre-commit) # Aliases for pre-commit (uses prek if available, else pre-commit)
if command -v prek &> /dev/null; then if command -v prek &> /dev/null; then
_prc_cmd='prek' _prc_cmd='prek'
_prc_autoupdate='auto-update'
else else
_prc_cmd='pre-commit' _prc_cmd='pre-commit'
_prc_autoupdate='autoupdate'
fi fi
alias prc="$_prc_cmd" alias prc="$_prc_cmd"
alias prcau="$_prc_cmd $_prc_autoupdate" alias prcau="$_prc_cmd autoupdate"
alias prcr="$_prc_cmd run" alias prcr="$_prc_cmd run"
alias prcra="$_prc_cmd run --all-files" alias prcra="$_prc_cmd run --all-files"
+11
View File
@@ -34,6 +34,8 @@ virtual environments:
`<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it (keeps venv activated `<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it (keeps venv activated
in subdirectories). in subdirectories).
- To enable the feature, set `PYTHON_AUTO_VRUN=true` before sourcing oh-my-zsh. - To enable the feature, set `PYTHON_AUTO_VRUN=true` before sourcing oh-my-zsh.
- To also search parent directories (useful for monorepos), set `PYTHON_AUTO_VRUN_RECURSIVE=true` as well.
The search stops before `$HOME`, so a venv in your home directory is not activated in every folder under it.
- The plugin activates the first existing virtual environment, in order, appearing in `$PYTHON_VENV_NAMES`. - The plugin activates the first existing virtual environment, in order, appearing in `$PYTHON_VENV_NAMES`.
The default virtual environment name is `venv`. To use a different name, set The default virtual environment name is `venv`. To use a different name, set
`PYTHON_VENV_NAME=<venv-name>`. For example: `PYTHON_VENV_NAME=".venv"` `PYTHON_VENV_NAME=<venv-name>`. For example: `PYTHON_VENV_NAME=".venv"`
@@ -44,6 +46,7 @@ You can set these variables in your `.zshrc` file, before Oh My Zsh is sourced.
For example: For example:
```sh ```sh
PYTHON_AUTO_VRUN=true
PYTHON_VENV_NAME=".venv" PYTHON_VENV_NAME=".venv"
PYTHON_VENV_NAMES=($PYTHON_VENV_NAME venv) PYTHON_VENV_NAMES=($PYTHON_VENV_NAME venv)
... ...
@@ -52,6 +55,14 @@ source "$ZSH/oh-my-zsh.sh"
``` ```
## `$PYTHON_AUTO_VRUN`
**Default**: `false`.
Enable automatic activation of virtual environments when entering a directory containing
`<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it.
Set to `true` to enable this feature.
## `$PYTHON_VENV_NAME` ## `$PYTHON_VENV_NAME`
**Default**: `venv`. **Default**: `venv`.
+16 -1
View File
@@ -113,8 +113,23 @@ if [[ "$PYTHON_AUTO_VRUN" == "true" ]]; then
# make sure we're not in a venv already # make sure we're not in a venv already
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1 (( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
source $file > /dev/null 2>&1 source $file > /dev/null 2>&1
break return
done done
# Search parent directories if recursive mode is enabled, stopping before $HOME
if [[ "$PYTHON_AUTO_VRUN_RECURSIVE" == "true" ]]; then
local search_dir="$PWD:h"
while [[ "$search_dir" != "/" && "$search_dir" != "." && "$search_dir" != "$HOME" ]]; do
for file in "${search_dir}/"${^PYTHON_VENV_NAMES[@]}"/bin/activate"(N.); do
# the venv found is already active
[[ "${file:h:h:A}" == "${VIRTUAL_ENV:A}" ]] && return
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
source $file > /dev/null 2>&1
return
done
search_dir="${search_dir:h}"
done
fi
fi fi
} }
add-zsh-hook chpwd auto_vrun add-zsh-hook chpwd auto_vrun
+16 -4
View File
@@ -1,6 +1,18 @@
# Autocompletion for svcat. # Autocompletion for the Service Catalog CLI (svcat).
# if (( ! $+commands[svcat] )); then
return
fi
if [ $commands[svcat] ]; then # If the completion file does not exist, generate it and then source it
source <(svcat completion zsh) # Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_svcat" ]]; then
svcat completion zsh | tee "$ZSH_CACHE_DIR/completions/_svcat" >/dev/null
source "$ZSH_CACHE_DIR/completions/_svcat"
else
source "$ZSH_CACHE_DIR/completions/_svcat"
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._svcat"
zf_mv -f -- =( svcat completion zsh ) "$ZSH_CACHE_DIR/completions/_svcat"
} &|
fi fi
+23 -1
View File
@@ -24,7 +24,7 @@ plugins=(... systemd)
| `sc-show-environment` | `systemctl show-environment` | Dump the systemd manager environment block | | `sc-show-environment` | `systemctl show-environment` | Dump the systemd manager environment block |
| `sc-cat` | `systemctl cat` | Show backing files of one or more units | | `sc-cat` | `systemctl cat` | Show backing files of one or more units |
| `sc-list-timers` | `systemctl list-timers` | List timer units currently in memory | | `sc-list-timers` | `systemctl list-timers` | List timer units currently in memory |
| **Aliases with sudo** ||| | **Privileged aliases** |||
| `sc-start` | `sudo systemctl start` | Start Unit(s) | | `sc-start` | `sudo systemctl start` | Start Unit(s) |
| `sc-stop` | `sudo systemctl stop` | Stop Unit(s) | | `sc-stop` | `sudo systemctl stop` | Stop Unit(s) |
| `sc-reload` | `sudo systemctl reload` | Reload Unit(s) | | `sc-reload` | `sudo systemctl reload` | Reload Unit(s) |
@@ -50,6 +50,28 @@ plugins=(... systemd)
| `sc-disable-now` | `sudo systemctl disable --now` | Disable and stop unit(s) | | `sc-disable-now` | `sudo systemctl disable --now` | Disable and stop unit(s) |
| `sc-mask-now` | `sudo systemctl mask --now` | Mask and stop unit(s) | | `sc-mask-now` | `sudo systemctl mask --now` | Mask and stop unit(s) |
### Privileged aliases
systemd plugin supports alternative privilege elevation tools. You can prepend an arbitrary string,
replacing `sudo`, to the privileged aliases by setting `$ZSH_SYSTEMD_SUDO` variable. You can leave
authorization to systemd by setting `$ZSH_SYSTEMD_SUDO` to an empty string.
To use `doas` as your elevation tool you will need to add the following line to your zshrc;
```zsh
ZSH_SYSTEMD_SUDO="doas"
```
After shell restart, you will see that alias for `sc-enable` is changed:
```sh
$ which sc-enable
sc-enable: aliased to doas systemctl enable
```
These aliases are evaluated during oh-my-zsh startup, and can't be changed interactively (you will
need to restart shell to see changes).
### User aliases ### User aliases
You can use the above aliases as `--user` by using the prefix `scu` instead of `sc`. You can use the above aliases as `--user` by using the prefix `scu` instead of `sc`.
+16 -5
View File
@@ -67,15 +67,27 @@ power_commands=(
suspend suspend
) )
if ! [[ -v ZSH_SYSTEMD_SUDO ]]; then
ZSH_SYSTEMD_SUDO="sudo"
fi
for c in $user_commands; do for c in $user_commands; do
alias "sc-$c"="systemctl $c" alias "sc-$c"="systemctl $c"
alias "scu-$c"="systemctl --user $c" alias "scu-$c"="systemctl --user $c"
done done
for c in $sudo_commands; do # Avoids leading space in alias when using polkit
alias "sc-$c"="sudo systemctl $c" if [[ -n "${ZSH_SYSTEMD_SUDO}" ]]; then
alias "scu-$c"="systemctl --user $c" for c in $sudo_commands; do
done alias "sc-$c"="$ZSH_SYSTEMD_SUDO systemctl $c"
alias "scu-$c"="systemctl --user $c"
done
else
for c in $sudo_commands; do
alias "sc-$c"="systemctl $c"
alias "scu-$c"="systemctl --user $c"
done
fi
for c in $power_commands; do for c in $power_commands; do
alias "sc-$c"="systemctl $c" alias "sc-$c"="systemctl $c"
@@ -83,7 +95,6 @@ done
unset c user_commands sudo_commands power_commands unset c user_commands sudo_commands power_commands
# --now commands # --now commands
alias sc-enable-now="sc-enable --now" alias sc-enable-now="sc-enable --now"
alias sc-disable-now="sc-disable --now" alias sc-disable-now="sc-disable --now"
+20
View File
@@ -0,0 +1,20 @@
# talosctl plugin
This plugin adds completion for the [talosctl](https://docs.siderolabs.com/talos/v1.12/learn-more/talosctl) CLI for managing [Talos](https://github.com/siderolabs/talos) Linux.
To use it, add `talosctl` to the plugins array in your zshrc file:
```zsh
plugins=(... talosctl)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script and is automatically updated asynchronously when the plugin is
loaded, which is usually when you start up a new terminal emulator.
The cache is stored at:
- `$ZSH_CACHE/completions/_talosctl` completions script
+18
View File
@@ -0,0 +1,18 @@
# Autocompletion for talosctl
if (( ! $+commands[talosctl] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `talosctl`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_talosctl" ]]; then
typeset -g -A _comps
autoload -Uz _talosctl
_comps[talosctl]=_talosctl
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._talosctl"
zf_mv -f -- =( talosctl completion zsh ) "$ZSH_CACHE_DIR/completions/_talosctl"
} &|
+53
View File
@@ -0,0 +1,53 @@
# Terragrunt plugin
Terragrunt is a thin wrapper for opentofu/terraform that provides extra tools
and features to enhance the management of Infrastructure as Code (IaC) using
opentofu/terraform. This plugin adds completion for `terragrunt` command, as well
as aliases and a prompt function.
To use it, add `terragrunt` to the plugins array of your `~/.zshrc` file:
```shell
plugins=(... terragrunt)
```
## Requirements
- [Terragrunt](https://docs.terragrunt.com/) v0.77.22 or later
## Aliases
| Alias | Command |
| ------ | ----------------------------------------- |
| `tg` | `terragrunt` |
| `tga` | `terragrunt run -- apply` |
| `tgaa` | `terragrunt run -- apply -auto-approve` |
| `tgc` | `terragrunt run -- console` |
| `tgd` | `terragrunt run -- destroy` |
| `tgd!` | `terragrunt run -- destroy -auto-approve` |
| `tgi` | `terragrunt run -- init` |
| `tgo` | `terragrunt run -- output` |
| `tgp` | `terragrunt run -- plan` |
| `tgv` | `terragrunt run -- validate` |
| `tgs` | `terragrunt run -- state` |
| `tgsh` | `terragrunt run -- show` |
| `tgr` | `terragrunt run -- refresh` |
| `tgt` | `terragrunt run -- test` |
| `tgws` | `terragrunt run -- workspace` |
## Prompt function
- `terragrunt_version_prompt_info` shows the current version of the `terragrunt` command.
To use it, add it to a `PROMPT` or `RPROMPT` variable in your theme or `.zshrc` file.
```sh
RPROMPT='$(terragrunt_version_prompt_info)'
```
You can also specify the PREFIX and SUFFIX strings with the following variables.
```sh
ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_SUFFIX="%{$reset_color%}"
```
+27
View File
@@ -0,0 +1,27 @@
# set up the terragrunt completion (compatible for zsh)
autoload -Uz bashcompinit && bashcompinit
complete -C terragrunt terragrunt
# terragrunt version prompt function
function terragrunt_version_prompt_info() {
# get the output of `terragrunt --version` in a single line, and get the third word after splitting by a space
local terragrunt_version=${${(s: :)$(terragrunt --version)}[3]}
# make sure to escape % signs in the version string to prevent command injection
echo "${ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_PREFIX-[}${terragrunt_version:gs/%/%%}${ZSH_THEME_TERRAGRUNT_VERSION_PROMPT_SUFFIX-]}"
}
alias tg='terragrunt'
alias tga='terragrunt run -- apply'
alias tgaa='terragrunt run -- apply -auto-approve'
alias tgc='terragrunt run -- console'
alias tgd='terragrunt run -- destroy'
alias tgd!='terragrunt run -- destroy -auto-approve'
alias tgi='terragrunt run -- init'
alias tgo='terragrunt run -- output'
alias tgp='terragrunt run -- plan'
alias tgv='terragrunt run -- validate'
alias tgs='terragrunt run -- state'
alias tgsh='terragrunt run -- show'
alias tgr='terragrunt run -- refresh'
alias tgt='terragrunt run -- test'
alias tgws='terragrunt run -- workspace'
+9
View File
@@ -39,6 +39,15 @@ plugins=(... vi-mode)
- `VI_MODE_DISABLE_CLIPBOARD`: If set, disables clipboard integration on yank/paste - `VI_MODE_DISABLE_CLIPBOARD`: If set, disables clipboard integration on yank/paste
Clipboard integration keeps put widgets (`p`/`P`) in sync with the system
clipboard, but only while the last copy to the clipboard actually succeeded.
If that copy failed — no `xclip`/`xsel`, Wayland without `wl-clipboard`, a dead
X forwarding over SSH — the clipboard no longer mirrors what you killed inside
the line editor, so puts use the internal kill buffer instead of the stale
clipboard contents. After a failed push, puts keep using the kill buffer only
while the clipboard still holds exactly what it held when the push failed; a
new external copy is picked up again immediately.
## Mode indicators ## Mode indicators
*Normal mode* is indicated with a red `<<<` mark at the right prompt, when it *Normal mode* is indicated with a red `<<<` mark at the right prompt, when it
+31 -2
View File
@@ -118,6 +118,15 @@ bindkey '^s' history-incremental-search-forward
bindkey '^a' beginning-of-line bindkey '^a' beginning-of-line
bindkey '^e' end-of-line bindkey '^e' end-of-line
# Snapshot of the clipboard taken when the most recent push to it failed.
# While the marker is set, put widgets compare the live clipboard against the
# snapshot: unchanged means the clipboard is stale (it never received the
# kill), so the internal CUTBUFFER is used instead. As soon as the clipboard
# differs again - e.g. an external copy - it is trusted immediately, so
# external copies are never lost for longer than the failure itself.
typeset -g _OMZ_VI_CLIPBOARD_STALE=""
typeset -g _OMZ_VI_CLIPBOARD_STALE_SET=""
function wrap_clipboard_widgets() { function wrap_clipboard_widgets() {
# NB: Assume we are the first wrapper and that we only wrap native widgets # NB: Assume we are the first wrapper and that we only wrap native widgets
# See zsh-autosuggestions.zsh for a more generic and more robust wrapper # See zsh-autosuggestions.zsh for a more generic and more robust wrapper
@@ -132,13 +141,33 @@ function wrap_clipboard_widgets() {
eval " eval "
function ${wrapped_name}() { function ${wrapped_name}() {
zle .${widget} zle .${widget}
printf %s \"\${CUTBUFFER}\" | clipcopy 2>/dev/null || true # On a failed push, snapshot the clipboard so put widgets can tell
# stale content (which never received this kill) apart from later
# external copies.
if printf %s \"\${CUTBUFFER}\" | clipcopy 2>/dev/null; then
_OMZ_VI_CLIPBOARD_STALE_SET=\"\"
else
_OMZ_VI_CLIPBOARD_STALE=\"\$(clippaste 2>/dev/null)\"
_OMZ_VI_CLIPBOARD_STALE_SET=1
fi
} }
" "
else else
eval " eval "
function ${wrapped_name}() { function ${wrapped_name}() {
CUTBUFFER=\"\$(clippaste 2>/dev/null || echo \$CUTBUFFER)\" if [[ -n \"\${_OMZ_VI_CLIPBOARD_STALE_SET:-}\" ]]; then
# Last push failed. If the clipboard still matches the snapshot
# taken at the failure, it is stale: keep the internal CUTBUFFER.
# If it differs, an external copy arrived since - trust it again
# and clear the stale state.
local _clip=\"\$(clippaste 2>/dev/null)\"
if [[ \"\$_clip\" != \"\${_OMZ_VI_CLIPBOARD_STALE}\" ]]; then
CUTBUFFER=\"\$_clip\"
_OMZ_VI_CLIPBOARD_STALE_SET=\"\"
fi
else
CUTBUFFER=\"\$(clippaste 2>/dev/null || echo \$CUTBUFFER)\"
fi
zle .${widget} zle .${widget}
} }
" "
+3 -2
View File
@@ -53,10 +53,11 @@ function web_search() {
# search or go to main page depending on number of arguments passed # search or go to main page depending on number of arguments passed
if [[ $# -gt 1 ]]; then if [[ $# -gt 1 ]]; then
# if search goes in the query string ==> space as +, otherwise %20 # if search goes in the query string ==> space as + and escape reserved
# characters like & and +, otherwise %20
# see https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20 # see https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20
local param="-P" local param="-P"
[[ "$urls[$1]" == *\?*= ]] && param="" [[ "$urls[$1]" == *\?*= ]] && param="-r"
# build search url: # build search url:
# join arguments passed with '+', then append to search engine URL # join arguments passed with '+', then append to search engine URL
+43
View File
@@ -0,0 +1,43 @@
# zellij
This plugin provides aliases, functions, and completions for [zellij](https://zellij.dev/),
the terminal workspace (multiplexer). To use it, add `zellij` to the plugins array in your
zshrc file.
```zsh
plugins=(... zellij)
```
## Aliases
| Alias | Command | Description |
| ------ | ---------------------------- | --------------------------- |
| `zj` | `zellij` | Zellij command |
| `zjl` | `zellij list-sessions` | List sessions |
| `zjs` | `zellij -s` | Start a named session |
| `zjda` | `zellij delete-all-sessions` | Delete all sessions |
| `zjka` | `zellij kill-all-sessions` | Kill all sessions |
| `zjr` | `zellij run` | Run a command in a pane |
| `zjad` | `zellij action detach` | Detach from current session |
## Functions
| Function | Command | Description |
| -------- | -------------------------------- | -------------------------------- |
| `zja` | `zellij attach` | Attach to a session |
| `zjd` | `zellij delete-session` | Delete a session (exited only) |
| `zjdf` | `zellij delete-session --force` | Force-delete any session |
| `zjk` | `zellij kill-session` | Kill a session |
| `zjas` | `zellij action switch-session` | Switch to a session |
| `zjrf` | `zellij run --floating --` | Run a command in a floating pane |
| `zje` | `zellij edit` | Edit a file in a pane |
## Completions
This plugin caches the zellij completion script. On first load the cache is generated
synchronously; subsequent updates (when the `zellij` binary is newer than the cache) happen in
the background. The cache is written to a temporary file and moved into place, so a
partially written file is never loaded.
Session-aware completions are provided for `zja`, `zjdf` and `zjas` (all sessions), `zjk`
(running sessions) and `zjd` (exited sessions).
+77
View File
@@ -0,0 +1,77 @@
if (( ! $+commands[zellij] )); then
return
fi
# Aliases
alias zj='zellij'
alias zjl='zellij list-sessions'
alias zjs='zellij -s'
alias zjda='zellij delete-all-sessions'
alias zjka='zellij kill-all-sessions'
alias zjr='zellij run'
alias zjad='zellij action detach'
# Functions (with session-aware completion)
function zja { command zellij attach "$@"; }
function zjd { command zellij delete-session "$@"; }
function zjdf { command zellij delete-session --force "$@"; }
function zjk { command zellij kill-session "$@"; }
function zjas { command zellij action switch-session "$@"; }
# Convenience functions
function zjrf { command zellij run --floating -- "$@"; }
function zje { command zellij edit "$@"; }
# Completion cache: generate synchronously on first load, regenerate in the
# background when the zellij binary is newer than the cache. Write to a temp
# file in the same directory and rename it, so a partial file is never loaded.
_omz_zellij_gen_completion() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._zellij"
zf_mv -f -- =( command zellij setup --generate-completion zsh 2>/dev/null ) "$ZSH_CACHE_DIR/completions/_zellij"
}
zmodload -F zsh/files b:zf_mv
if [[ ! -s "$ZSH_CACHE_DIR/completions/_zellij" ]]; then
_omz_zellij_gen_completion
elif [[ $commands[zellij] -nt "$ZSH_CACHE_DIR/completions/_zellij" ]]; then
_omz_zellij_gen_completion &|
fi
_omz_zellij_ls_raw() {
command zellij list-sessions --no-formatting 2>/dev/null || command zellij list-sessions 2>/dev/null
}
_omz_zellij_session_names() {
# Use --short if available (zellij >= 0.44), fall back to sed parsing
command zellij list-sessions --short --no-formatting 2>/dev/null \
|| _omz_zellij_ls_raw | LC_ALL=C sed -nE 's/^([^[:space:]]+).*/\1/p'
}
_omz_zellij_all_sessions() {
emulate -L zsh
local -a sessions
sessions=(${(f)"$(_omz_zellij_session_names)"})
(( ${#sessions} )) && compadd -Q -a sessions
}
_omz_zellij_running_sessions() {
emulate -L zsh
local -a sessions
sessions=(${(f)"$(_omz_zellij_ls_raw | LC_ALL=C sed -nE '/\(EXITED/!s/^([^[:space:]]+).*/\1/p')"})
(( ${#sessions} )) && compadd -Q -a sessions
}
_omz_zellij_exited_sessions() {
emulate -L zsh
local -a sessions
sessions=(${(f)"$(_omz_zellij_ls_raw | LC_ALL=C sed -nE '/\(EXITED/s/^([^[:space:]]+).*/\1/p')"})
(( ${#sessions} )) && compadd -Q -a sessions
}
if (( $+functions[compdef] )); then
autoload -Uz _zellij
compdef _zellij zellij
compdef _omz_zellij_all_sessions zja zjdf zjas
compdef _omz_zellij_running_sessions zjk
compdef _omz_zellij_exited_sessions zjd
fi
+3
View File
@@ -4,6 +4,9 @@ Initializes [zsh-patina](https://github.com/michel-kraemer/zsh-patina), a
"blazingly fast Zsh plugin performing syntax highlighting of your command line "blazingly fast Zsh plugin performing syntax highlighting of your command line
while you type 🌈" while you type 🌈"
The plugin also caches completions for the `zsh-patina` command in
`$ZSH_CACHE_DIR/completions/_zsh-patina`, refreshed each time the plugin loads.
To use it, add `zsh-patina` to the plugins array in your `.zshrc` file: To use it, add `zsh-patina` to the plugins array in your `.zshrc` file:
```zsh ```zsh
+14
View File
@@ -2,6 +2,20 @@ if (( $+ZSH_HIGHLIGHT_VERSION )) || (( ${plugins[(Ie)zsh-syntax-highlighting]} )
echo '[oh-my-zsh] zsh-patina conflicts with zsh-syntax-highlighting, please enable only one of them' echo '[oh-my-zsh] zsh-patina conflicts with zsh-syntax-highlighting, please enable only one of them'
elif [[ -x ${ZSH_PATINA_BINARY:-$commands[zsh-patina]} ]]; then elif [[ -x ${ZSH_PATINA_BINARY:-$commands[zsh-patina]} ]]; then
eval "$(${ZSH_PATINA_BINARY:-$commands[zsh-patina]} activate)" eval "$(${ZSH_PATINA_BINARY:-$commands[zsh-patina]} activate)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `zsh-patina`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_zsh-patina" ]]; then
typeset -g -A _comps
autoload -Uz _zsh-patina
_comps[zsh-patina]=_zsh-patina
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._zsh-patina"
zf_mv -f -- =( "$1" completion ) "$ZSH_CACHE_DIR/completions/_zsh-patina"
} "${ZSH_PATINA_BINARY:-$commands[zsh-patina]}" &|
else else
echo '[oh-my-zsh] zsh-patina not found, please install it from https://github.com/michel-kraemer/zsh-patina' echo '[oh-my-zsh] zsh-patina not found, please install it from https://github.com/michel-kraemer/zsh-patina'
fi fi
+2 -2
View File
@@ -160,13 +160,13 @@ function update_ohmyzsh() {
fi fi
if [[ "$update_mode" != background-alpha ]] \ if [[ "$update_mode" != background-alpha ]] \
&& LANG= ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode -c $cooldown_days; then && LANG= ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode -c $cooldown_days; then
update_last_updated_file update_last_updated_file
return $? return $?
fi fi
local exit_status error local exit_status error
if error=$(LANG= ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" -i -v silent -c $cooldown_days 2>&1); then if error=$(LANG= ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -i -v silent -c $cooldown_days 2>&1); then
update_last_updated_file 0 "Update successful" update_last_updated_file 0 "Update successful"
else else
exit_status=$? exit_status=$?