Skip to content

Instantly share code, notes, and snippets.

@rrotter
Last active October 23, 2024 03:07
Show Gist options
  • Save rrotter/ecb8fabfb981a92caf1d8a904fbc01ef to your computer and use it in GitHub Desktop.
Save rrotter/ecb8fabfb981a92caf1d8a904fbc01ef to your computer and use it in GitHub Desktop.
fix zsh file completion if you're stuck on an unpatched version of zsh 5.9
site-functions # diff /usr/share/zsh/5.9/functions/_path_files /usr/local/share/zsh/site-functions/_path_files
--- /usr/share/zsh/5.9/functions/_path_files 2024-10-01 00:10:49
+++ XX_path_files 2024-10-19 02:25:56
@@ -145,7 +145,9 @@
if [[ $#matcher -eq 0 && -o nocaseglob ]]; then
# If globbing is case insensitive and there's no matcher,
# do case-insensitive matching.
- matcher=( -M 'm:{a-zA-Z}={A-Za-z}' )
+ # work around bug in zsh 5.9
+ #matcher=( -M 'm:{a-zA-Z}={A-Za-z}' )
+ matcher=( -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' )
fi
@rrotter
Copy link
Author

rrotter commented Oct 19, 2024

This code is unchanged in newer versions of zsh. This is a work around for an off-by-1 error in zsh's C code. Most distros have long since backported a fix that is available in the upstream zsh repo, but which isn't yet part of an official release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment