Genivia / ugrep

NEW ugrep 7.1: a more powerful, ultra fast, user-friendly, compatible grep. Includes a TUI, Google-like Boolean search with AND/OR/NOT, fuzzy search, hexdumps, searches (nested) archives (zip, 7z, tar, pax, cpio), compressed files (gz, Z, bz2, lzma, xz, lz4, zstd, brotli), pdfs, docs, and more
https://ugrep.com
BSD 3-Clause "New" or "Revised" License
2.66k stars 111 forks source link

Zsh completion doesn't complete flags after positional arguments #392

Closed AndydeCleyre closed 6 months ago

AndydeCleyre commented 6 months ago

6.0.0

Given the file sample.txt:

abcd

Each of the following commands will work as expected:

$ ugrep bc sample.txt --only-matching
$ ugrep bc --only-matching
$ ug bc sample.txt --only-matching
$ ug bc --only-matching

But in none of those cases will the --only-matching flag be tab-completed.

genivia-inc commented 6 months ago

Unlike fish and bash completions, zsh options are completed when specified before the pattern and file arguments. If you know how to get zsh completions to also work after pattern and/or file arguments then let me know.

AndydeCleyre commented 6 months ago

I haven't figured it out, but can provide the example of ripgrep's Zsh completion, which seems to achieve the goal.

genivia-inc commented 6 months ago

Zsh grep completions do a better job and have been around for a long time. Since ugrep is backward compatible to grep, I'll try to work some of the zsh grep completions into ugrep's completions.

genivia-inc commented 6 months ago

Committed a fix. This update also makes several options repeatable when they are repeatable, such as -e PATTERN, same as zsh grep completions.

AndydeCleyre commented 6 months ago

Thank you!

genivia-inc commented 5 months ago

Completions are updated in release 6.1.