Skip to content

Instantly share code, notes, and snippets.

@bartman
Last active June 2, 2025 13:06
Show Gist options
  • Save bartman/ec306408a0ef20342236c872b904b7bf to your computer and use it in GitHub Desktop.
Save bartman/ec306408a0ef20342236c872b904b7bf to your computer and use it in GitHub Desktop.
zsh option completion broken by uutils-coreutils override [NixOS 25.05]

Here is the change in my config...

 {
   home.packages = with pkgs; [
-    uutils-coreutils
+    (uutils-coreutils.override { prefix = ""; })
   ];
 }

with override, any newly started shell will fail to tab complete.

it always prints these options; it does not matter what the command is.

❯ git -<TAB>
---- option
--help     -h  -- Print help
--initial  -i  -- do not convert tabs after non blanks
--no-utf8  -U  -- interpret input file as 8-bit ASCII rather than UTF-8
--tabs     -t  -- have tabs N characters apart, not 8 or use comma separated list of explicit tab positions
--version  -V  -- Print version

with the override removed, it completes correctly for all commands, including uutils-* commands.

The text seems to come from uutils version of expand...

❯ /nix/store/mpydakrn48703wlwc4jgx4wp35p0559c-uutils-coreutils-0.0.30/bin/expand --help
Convert tabs in each `FILE` to spaces, writing to standard output.
With no `FILE`, or when `FILE` is `-`, read standard input.

Usage: /nix/store/mpydakrn48703wlwc4jgx4wp35p0559c-uutils-coreutils-0.0.30/bin/expand [OPTION]... [FILE]...

Options:
  -i, --initial         do not convert tabs after non blanks
  -t, --tabs <N, LIST>  have tabs N characters apart, not 8 or use comma separated list of explicit tab positions
  -U, --no-utf8         interpret input file as 8-bit ASCII rather than UTF-8
  -h, --help            Print help
  -V, --version         Print version

zsh tab completion script must be using expand in a slightly different way, then getting the error from expand and thinking it's the help output from the tool.

@bartman
Copy link
Author

bartman commented Jun 2, 2025

looks like the issue was in my old zsh config that i have been pulling into my nix-generated config via programs.zsh.initExtraBeforeCompInit.

this fixes my issue.

- zstyle ':completion:*' completer _expand _complete _match _prefix _approximate _list

I wrote this old tab completion by hand 10 years ago, maybe it's time to let go.

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