PATCH: namei completion

Oliver Kiddle <[email protected]> Fri, 03 Jul 2026 18:06:23 +0200
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
One of the many tools from util-linux. Just using _files for completion
but it is mostly useful with full paths to check permissions on all the
path components leading up to a file.

Oliver

diff --git a/Completion/Linux/Command/_namei b/Completion/Linux/Command/_namei
new file mode 100644
index 000000000..6f3533eec
--- /dev/null
+++ b/Completion/Linux/Command/_namei
@@ -0,0 +1,15 @@
+#compdef namei
+
+local ign
+
+(( $#words > 2 )) && ign='!(* -)'
+_arguments -s -S \
+  '(-x --mountpoints)'{-x,--mountpoints}"[mark mount point directories with a 'D']" \
+  '(-m --modes -l --long)'{-m,--modes}'[show the permission bits of each file]' \
+  '(-o --owners -l --long)'{-o,--owners}'[show owner and group of each file]' \
+  '(-l --long -m --modes -o --owners -v --vertical)'{-l,--long}'[use long listing format (-m -o -v)]' \
+  '(-n --nosymlinks)'{-n,--nosymlinks}"[don't follow symlinks]" \
+  '(-v --vertical -l --long)'{-v,--vertical}'[align modes and owners vertically]' \
+  "$ign"{-h,--help}'[display usage information]' \
+  "$ign"{-V,--version}'[display version information]' \
+  '*: :_files'