Compare commits

..
Author SHA1 Message Date
Robby RussellandClaude Opus 5.5 4c184381d0 fix(key-bindings): make numeric keypad work in application mode
We switch the terminal into application keypad mode (smkx) so terminfo
key bindings are valid, but that also makes the numeric keypad send
escape sequences (\eOp..\eOy, \eOM, ...) that were never bound. Keypad
Enter rang the bell instead of running the command.

Map each keypad sequence back to the plain key with `bindkey -s`, so it
behaves exactly like the main keyboard key in emacs, viins and vicmd.

Fixes #13928

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:03:38 -07:00
Rasmus Skovgaard Lauritsen 9f9b28a13d feat(logcli): add completion plugin (#14158) 2026-10-08 16:49:20 -07:00
Zhiqi Zhang 361fb5c1ac fix(python): match two-digit minor versions in pyuserpaths (#14161)
The version pattern used the shortest match (#), so "Python 3.11.4"
was truncated to 3.1 and the ~/.local/lib/python3.11/site-packages
check never matched on python >= 3.10, leaving pyuserpaths a no-op.
Use a longest match (##) so the whole minor version is kept.
2026-10-08 16:46:10 -07:00
tuzi3040 3d9b557be3 fix(battery): make macOS regexes compatible with GNU grep (#14163)
* fix(battery): remove unnecessary whitespace escapes in macOS battery parsing

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

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


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

---
updated-dependencies:
- dependency-name: charset-normalizer
  dependency-version: 3.5.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: py-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-05 08:02:35 +02:00
ca0904 4d4cfc287e fix(universalarchive): support 7zz and 7z for 7z archives (#14147) 2026-09-29 17:38:41 +02:00
Haakon Meihack 92bf53f1ae fix(emacs): do not emit ANSI escape codes in ghostel (#14145) 2026-09-29 11:23:20 +02:00
Chetan Agrawal 5c4bb4aec5 fix(extract): support 7zz and 7z for 7z archives (#14144) 2026-09-29 11:20:42 +02:00
nervo 868da9cfd5 fix(sops): correct completion command (#14139) 2026-09-29 08:13:36 +02:00
14 changed files with 114 additions and 27 deletions

No files matched your search

+1 -1
View File
@@ -46,7 +46,7 @@ dependencies:
plugins/z: plugins/z:
branch: master branch: master
repo: agkozak/zsh-z repo: agkozak/zsh-z
version: 102fb78036ed76feedf623907483691777a1d510 version: 7f8ff4df11b50a14e3666c7cd212baa399c9b92a
precopy: | precopy: |
set -e set -e
rm -r tests rm -r tests
@@ -1,5 +1,5 @@
certifi==2026.7.22 certifi==2026.7.22
charset-normalizer==3.5.1 charset-normalizer==3.5.2
idna==3.20 idna==3.20
PyYAML==6.0.3 PyYAML==6.0.3
requests==2.34.2 requests==2.34.2
+17
View File
@@ -110,6 +110,23 @@ bindkey -M emacs '^[[1;5D' backward-word
bindkey -M viins '^[[1;5D' backward-word bindkey -M viins '^[[1;5D' backward-word
bindkey -M vicmd '^[[1;5D' backward-word bindkey -M vicmd '^[[1;5D' backward-word
# [Keypad] - application mode (enabled above) makes the keypad send escape
# sequences instead of characters, so map them back to the plain keys
() {
local seq key
local -A keypad=(
'^[Op' '0' '^[Oq' '1' '^[Or' '2' '^[Os' '3' '^[Ot' '4'
'^[Ou' '5' '^[Ov' '6' '^[Ow' '7' '^[Ox' '8' '^[Oy' '9'
'^[On' '.' '^[Ol' ',' '^[Ok' '+' '^[Om' '-' '^[Oj' '*'
'^[Oo' '/' '^[OX' '=' '^[OM' '^M'
)
for seq key in "${(@kv)keypad}"; do
bindkey -M emacs -s "$seq" "$key"
bindkey -M viins -s "$seq" "$key"
bindkey -M vicmd -s "$seq" "$key"
done
}
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
bindkey -s '\el' '^q ls\n' # [Esc-l] - run command: ls bindkey -s '\el' '^q ls\n' # [Esc-l] - run command: ls
+5 -5
View File
@@ -25,10 +25,10 @@ if [[ "$OSTYPE" = darwin* ]]; then
echo "$(ioreg -rc AppleSmartBattery | grep -o '"Watts"=[0-9]\+' | head -1 | grep -o '[0-9]\+')W " echo "$(ioreg -rc AppleSmartBattery | grep -o '"Watts"=[0-9]\+' | head -1 | grep -o '[0-9]\+')W "
} }
function battery_is_charging() { function battery_is_charging() {
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes' ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected" = Yes'
} }
function battery_pct() { function battery_pct() {
pmset -g batt | grep -Eo "\d+%" | cut -d% -f1 pmset -g batt | grep -Eo "[0-9]+%" | cut -d% -f1
} }
function battery_pct_remaining() { function battery_pct_remaining() {
if battery_is_charging; then if battery_is_charging; then
@@ -39,8 +39,8 @@ if [[ "$OSTYPE" = darwin* ]]; then
} }
function battery_time_remaining() { function battery_time_remaining() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected" = No') -eq 1 ]]; then
timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //') timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty" = ' | sed -e 's/^.*"AvgTimeToEmpty" = //')
if [ $timeremaining -gt 720 ]; then if [ $timeremaining -gt 720 ]; then
echo "::" echo "::"
else else
@@ -52,7 +52,7 @@ if [[ "$OSTYPE" = darwin* ]]; then
} }
function battery_pct_prompt () { function battery_pct_prompt () {
local battery_pct color local battery_pct color
if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected" = No'; then
battery_pct=$(battery_pct_remaining) battery_pct=$(battery_pct_remaining)
if [[ $battery_pct -gt 50 ]]; then if [[ $battery_pct -gt 50 ]]; then
color='green' color='green'
+3 -1
View File
@@ -35,7 +35,9 @@ alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
alias eframe='emacsclient --alternate-editor="" --create-frame' alias eframe='emacsclient --alternate-editor="" --create-frame'
# Emacs ANSI Term tracking # Emacs ANSI Term tracking
if [[ -n "$INSIDE_EMACS" ]] && [[ "$INSIDE_EMACS" != "vterm" ]]; then local excluded_terms=(vterm ghostel)
local current_term="${INSIDE_EMACS%%,*}"
if [[ -n "$INSIDE_EMACS" ]] && (( ! ${excluded_terms[(Ie)$current_term]} )); then
chpwd_emacs() { print -P "\033AnSiTc %d"; } chpwd_emacs() { print -P "\033AnSiTc %d"; }
print -P "\033AnSiTc %d" # Track current working directory print -P "\033AnSiTc %d" # Track current working directory
print -P "\033AnSiTu %n" # Track username print -P "\033AnSiTu %n" # Track username
+11 -1
View File
@@ -119,7 +119,17 @@ EOF
fi ;; fi ;;
(*.rpm) (*.rpm)
rpm2cpio "$full_path" | cpio --quiet -id ;; rpm2cpio "$full_path" | cpio --quiet -id ;;
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;; (*.7z | *.7z.[0-9]* | *.pk7)
if (( $+commands[7zz] )); then
7zz x "$full_path"
elif (( $+commands[7z] )); then
7z x "$full_path"
elif (( $+commands[7za] )); then
7za x "$full_path"
else
echo "extract: cannot extract 7z files: install 7zz, 7z or 7za" >&2
success=1
fi ;;
(*.deb) (*.deb)
command mkdir -p "control" "data" command mkdir -p "control" "data"
ar vx "$full_path" > /dev/null ar vx "$full_path" > /dev/null
+18
View File
@@ -0,0 +1,18 @@
# logcli plugin
This plugin adds completion for [Grafana Loki's logcli](https://grafana.com/docs/loki/latest/query/logcli/).
To use it, add `logcli` to the plugins array in your zshrc file:
```zsh
plugins=(... logcli)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script and automatically updates it when the
plugin is loaded, which is usually when you start a new terminal emulator.
The cache is stored at `$ZSH_CACHE_DIR/completions/_logcli`.
+18
View File
@@ -0,0 +1,18 @@
# Autocompletion for Grafana Loki's CLI (logcli).
if (( ! $+commands[logcli] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `logcli`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_logcli" ]]; then
typeset -g -A _comps
autoload -Uz _logcli
_comps[logcli]=_logcli
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._logcli"
zf_mv -f -- =( logcli --completion-script-zsh ) "$ZSH_CACHE_DIR/completions/_logcli"
} &|
+1 -1
View File
@@ -29,7 +29,7 @@ function pyuserpaths() {
# Get minor release version. # Get minor release version.
# The patch version is variable length, truncate it. # The patch version is variable length, truncate it.
version=${(M)${"$($python -V 2>&1)":7}#[^.]##.[^.]##} version=${(M)${"$($python -V 2>&1)":7}##[^.]##.[^.]##}
# Add version specific path, if: # Add version specific path, if:
# - it exists in the filesystem # - it exists in the filesystem
+1 -1
View File
@@ -14,5 +14,5 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._sops" local TMPPREFIX="$ZSH_CACHE_DIR/completions/._sops"
zf_mv -f -- =( sops completions zsh ) "$ZSH_CACHE_DIR/completions/_sops" zf_mv -f -- =( sops completion zsh ) "$ZSH_CACHE_DIR/completions/_sops"
} &| } &|
+1 -1
View File
@@ -52,7 +52,7 @@ The plugin will generate a default archive filename based on the input:
| Format | Description | Tool Used | | Format | Description | Tool Used |
|:-----------------|:-------------------------------|:-----------------| |:-----------------|:-------------------------------|:-----------------|
| `7z` | 7zip archive | `7z` | | `7z` | 7zip archive | `7zz`,`7z`,`7za` |
| `bz2` | Bzip2-compressed file | `bzip2` | | `bz2` | Bzip2-compressed file | `bzip2` |
| `gz` | Gzip-compressed file | `gzip` | | `gz` | Gzip-compressed file | `gzip` |
| `lzma` | LZMA-compressed file | `lzma` | | `lzma` | LZMA-compressed file | `lzma` |
@@ -49,7 +49,17 @@ tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst."
fi fi
case "$ext" in case "$ext" in
7z) 7z u "${output}" "${@}" ;; 7z)
if (( $+commands[7zz] )); then
7zz u "${output}" "${@}"
elif (( $+commands[7z] )); then
7z u "${output}" "${@}"
elif (( $+commands[7za] )); then
7za u "${output}" "${@}"
else
echo "ua: cannot create 7z files: install 7zz, 7z or 7za" >&2
return 1
fi ;;
bz2) bzip2 -vcf "${@}" > "${output}" ;; bz2) bzip2 -vcf "${@}" > "${output}" ;;
gz) gzip -vcf "${@}" > "${output}" ;; gz) gzip -vcf "${@}" > "${output}" ;;
lzma) lzma -vc -T0 "${@}" > "${output}" ;; lzma) lzma -vc -T0 "${@}" > "${output}" ;;
+12 -1
View File
@@ -38,6 +38,17 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
## News ## News
### v2.0.1 (October 1, 2026)
- **Database writes now work with `setopt NO_CLOBBER`.** Under `NO_CLOBBER`,
every database write could fail with `can't clobber parameter tmpfd containing
file descriptor 0`, even when the database already existed. That error no longer
occurs ([#81](https://github.com/agkozak/zsh-z/issues/81)).
- **Database and lockfile creation now works with `setopt NO_CLOBBER`.** With
`NO_CLOBBER` set and `APPEND_CREATE` unset, Zsh-z could not create a missing
database or lockfile. It now creates them without changing your shell options or
losing existing directory history ([#105](https://github.com/agkozak/zsh-z/issues/105)).
### v2.0 (August 14, 2026) ### v2.0 (August 14, 2026)
Version **2.0** is a major step forward, and these are the changes most worth knowing about: Version **2.0** is a major step forward, and these are the changes most worth knowing about:
@@ -47,7 +58,7 @@ Version **2.0** is a major step forward, and these are the changes most worth kn
- **Safer, crash-resistant concurrent writes.** Writes are now guarded by a dedicated, stable lockfile using `zsh/system` file locking, with a bounded wait for lock acquisition (the new [`ZSHZ_LOCK_TIMEOUT`](#settings), default `1` second). Write errors are handled gracefully, and locks are always released even if a write is interrupted. On Cygwin and MSYS2 a write is also retried briefly if Windows refuses it: a virus scanner or the search indexer that opens the database in the instant between its being written and its being moved into place makes the move fail, which used to lose that one directory silently. Zsh-z now retries the move briefly. - **Safer, crash-resistant concurrent writes.** Writes are now guarded by a dedicated, stable lockfile using `zsh/system` file locking, with a bounded wait for lock acquisition (the new [`ZSHZ_LOCK_TIMEOUT`](#settings), default `1` second). Write errors are handled gracefully, and locks are always released even if a write is interrupted. On Cygwin and MSYS2 a write is also retried briefly if Windows refuses it: a virus scanner or the search indexer that opens the database in the instant between its being written and its being moved into place makes the move fail, which used to lose that one directory silently. Zsh-z now retries the move briefly.
- **Your database file now has `600` permissions** -- readable and writable only by you -- so that other users on a shared system cannot read your directory history ([#92](https://github.com/agkozak/zsh-z/issues/92)). On Zsh 5+ this uses the in-process `zf_chmod` builtin; on Zsh 4.3.11 it uses a `umask`-in-a-subshell technique that avoids the fork-and-exec of an external `chmod`. - **Your database file now has `600` permissions** -- readable and writable only by you -- so that other users on a shared system cannot read your directory history ([#92](https://github.com/agkozak/zsh-z/issues/92)). On Zsh 5+ this uses the in-process `zf_chmod` builtin; on Zsh 4.3.11 it uses a `umask`-in-a-subshell technique that avoids the fork-and-exec of an external `chmod`.
- **`COMPLETE_ALIASES` works automatically in normal setups.** Tab completion no longer breaks when you have `setopt COMPLETE_ALIASES` enabled. Zsh-z registers the alias automatically on the first Tab press, so the manual `compdef` line that earlier versions required is no longer necessary. [See below](#complete_aliases). - **`COMPLETE_ALIASES` works automatically in normal setups.** Tab completion no longer breaks when you have `setopt COMPLETE_ALIASES` enabled. Zsh-z registers the alias automatically on the first Tab press, so the manual `compdef` line that earlier versions required is no longer necessary. [See below](#complete_aliases).
- **Fixed a `can't clobber parameter tmpfd` error on some Zsh builds.** On certain Zsh builds, every database write could fail with `can't clobber parameter tmpfd containing file descriptor 0`, leaving an error at each new prompt. The file descriptor used for the temporary database file is now held in an unset scalar rather than one seeded with `0`, so the write never trips Zsh's file-descriptor-clobber guard ([#81](https://github.com/agkozak/zsh-z/issues/81)). - **Fixed a `can't clobber parameter tmpfd` error on some Zsh builds.** On certain Zsh builds, every database write could fail with `can't clobber parameter tmpfd containing file descriptor 0`, leaving an error at each new prompt ([#81](https://github.com/agkozak/zsh-z/issues/81)). *Correction:* the error occurs under `setopt NO_CLOBBER`, and the v2.0 change did not fix it there; v2.0.1 does.
- **A misconfigured database file no longer closes your shell -- or nags you at every prompt.** When `ZSHZ_DATA` points at a directory, or names a file without a directory, Zsh-z now reports the problem and returns instead of calling `exit`. The per-prompt `--add` stays quiet about it, so you are told once, when you actually run `z`, rather than at every prompt ([#103](https://github.com/agkozak/zsh-z/issues/103); props @ahjota). - **A misconfigured database file no longer closes your shell -- or nags you at every prompt.** When `ZSHZ_DATA` points at a directory, or names a file without a directory, Zsh-z now reports the problem and returns instead of calling `exit`. The per-prompt `--add` stays quiet about it, so you are told once, when you actually run `z`, rather than at every prompt ([#103](https://github.com/agkozak/zsh-z/issues/103); props @ahjota).
- **`z -x` can now remove the entry for a directory that no longer exists -- and can no longer crash Zsh 4.3.11.** The removal target used to have to exist on disk, so a database entry whose directory had been deleted -- exactly the entry you most want gone -- could not be removed. `z -x /deleted/dir` (and `z -xR`) now canonicalizes the argument without requiring it to exist, resolving symlinks in as much of the path as is still present. The same change fixes a crash on Zsh 4.3.11, where an upstream bug makes `${x:A}` segfault when the top-level component of the path is missing: `z -x /gone/sub` -- or a `ZSHZ_DATA` pointing into a missing top-level directory -- could kill the shell there. - **`z -x` can now remove the entry for a directory that no longer exists -- and can no longer crash Zsh 4.3.11.** The removal target used to have to exist on disk, so a database entry whose directory had been deleted -- exactly the entry you most want gone -- could not be removed. `z -x /deleted/dir` (and `z -xR`) now canonicalizes the argument without requiring it to exist, resolving symlinks in as much of the path as is still present. The same change fixes a crash on Zsh 4.3.11, where an upstream bug makes `${x:A}` segfault when the top-level component of the path is missing: `z -x /gone/sub` -- or a `ZSHZ_DATA` pointing into a missing top-level directory -- could kill the shell there.
- **More robust startup and operation.** A version check on an unsupported Zsh no longer risks exiting your interactive shell. - **More robust startup and operation.** A version check on an unsupported Zsh no longer risks exiting your interactive shell.
+14 -13
View File
@@ -371,16 +371,17 @@ zshz() {
# before the lock is taken, and on Cygwin/MSYS2 a concurrent writer's rename # before the lock is taken, and on Cygwin/MSYS2 a concurrent writer's rename
# passes through a window in which the datafile is unlinked or delete- # passes through a window in which the datafile is unlinked or delete-
# pending, so any second syscall on the path (chmod) -- or even the creating # pending, so any second syscall on the path (chmod) -- or even the creating
# open itself -- can fail spuriously. Append mode (>>) creates the file # open itself -- can fail spuriously. Forced append redirection (>>|) creates
# without truncating one that a concurrent writer has just renamed into # the file even under NO_CLOBBER with APPEND_CREATE disabled, without
# place. The first attempt is silent; if the file still does not exist # truncating one that a concurrent writer has just renamed into place.
# The first attempt is silent; if the file still does not exist
# afterward (so no concurrent writer supplied it), retry loudly so that real # afterward (so no concurrent writer supplied it), retry loudly so that real
# failures (directory permissions, read-only filesystem) reach the user. # failures (directory permissions, read-only filesystem) reach the user.
[[ -f $datafile ]] || { [[ -f $datafile ]] || {
mkdir -p "${datafile:h}" && mkdir -p "${datafile:h}" &&
( umask 077; : >> "$datafile" ) 2> /dev/null || ( umask 077; : >>| "$datafile" ) 2> /dev/null ||
[[ -f $datafile ]] || [[ -f $datafile ]] ||
( umask 077; : >> "$datafile" ) ( umask 077; : >>| "$datafile" )
# When $ZSHZ_OWNER is set (e.g. under `sudo -s'), hand the freshly created # When $ZSHZ_OWNER is set (e.g. under `sudo -s'), hand the freshly created
# file off to that user immediately, so a query-only invocation can't leave # file off to that user immediately, so a query-only invocation can't leave
# behind a root-owned .z that the normal-user shell can't read. `-h' so a # behind a root-owned .z that the normal-user shell can't read. `-h' so a
@@ -525,14 +526,14 @@ zshz() {
# two-inodes race the stable lockfile exists to prevent. # two-inodes race the stable lockfile exists to prevent.
# Under $ZSHZ_OWNER all of this runs with root's authority on a path the # Under $ZSHZ_OWNER all of this runs with root's authority on a path the
# unprivileged owner controls, and every step follows a symlink: `-f' # unprivileged owner controls, and every step follows a symlink: `-f'
# tests the target, `>>' creates a dangling one, and flock opens it. # tests the target, `>>|' creates a dangling one, and flock opens it.
# $datafile survives a planted link only because the `mv' below replaces # $datafile survives a planted link only because the `mv' below replaces
# it outright; the lockfile is deliberately never removed, so a symlink # it outright; the lockfile is deliberately never removed, so a symlink
# here would persist and be acted on at every subsequent write. Refuse. # here would persist and be acted on at every subsequent write. Refuse.
local _lock_owner=${ZSHZ_OWNER:-${_Z_OWNER}} local _lock_owner=${ZSHZ_OWNER:-${_Z_OWNER}}
[[ -n $_lock_owner && -L $lockfile ]] && return 1 [[ -n $_lock_owner && -L $lockfile ]] && return 1
if [[ ! -f $lockfile ]]; then if [[ ! -f $lockfile ]]; then
( umask 077; : >> "$lockfile" ) 2> /dev/null ( umask 077; : >>| "$lockfile" ) 2> /dev/null
[[ -n $_lock_owner ]] && [[ -n $_lock_owner ]] &&
${ZSHZ[CHOWN]} -h "${_lock_owner}:$(id -ng "${_lock_owner}")" "$lockfile" ${ZSHZ[CHOWN]} -h "${_lock_owner}:$(id -ng "${_lock_owner}")" "$lockfile"
fi fi
@@ -585,13 +586,13 @@ zshz() {
# Discard entries that are incomplete or incorrectly formatted # Discard entries that are incomplete or incorrectly formatted
lines=( ${(M)lines:#/*\|[[:digit:]]##[.,]#[[:digit:]]#\|[[:digit:]]##} ) lines=( ${(M)lines:#/*\|[[:digit:]]##[.,]#[[:digit:]]#\|[[:digit:]]##} )
# Hold the fd in an *unset* scalar, not `integer tmpfd' (which seeds it # Explicitly unset the local scalar before allocating a file descriptor.
# with 0). On some Zsh builds, `exec {tmpfd}>|...' refuses to clobber a # Under NO_CLOBBER, even an empty scalar can be treated as fd 0 (stdin),
# parameter already holding a number that names an open fd -- and 0 is # causing `exec {tmpfd}>|...' to refuse to overwrite it. The `>|' only
# stdin, always open -- yielding "can't clobber parameter tmpfd # overrides file clobber protection, not the descriptor parameter check.
# containing file descriptor 0". An empty scalar isn't a valid fd, so # See https://github.com/agkozak/zsh-z/issues/81
# the guard never fires. See https://github.com/agkozak/zsh-z/issues/81
local tmpfd local tmpfd
unset tmpfd
case $action in case $action in
--add) --add)
# When zf_chmod isn't available (Zsh 4.3.11), avoid the # When zf_chmod isn't available (Zsh 4.3.11), avoid the