Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH for _diff_options to allow argument to -u



Hello!

I recently discovered that you can control the amount of context that
diff -u or -c gives you. Shortly thereafter it became very annoying
that the zsh completion sees characters (other than other option
characters) immediately following -u (or -c) as the original file name
and thus won't complete the new file once you get as far as "diff -u0
orig". The patch below makes the completion treat them the same way
the option handling in diff does.

This leaves the completion still thinking A is the original file name
if you type for instance "diff -wA orig" whereas diff complains that A
is an invalid option, but since diff will make you retype the command
anyway it's not necessarily worth fixing.

--- /usr/share/zsh/4.2.5/functions/Completion/Unix/_diff_options        2005-04-06 17:30:29.000000000 +0200
+++ init/zshfunctions/_diff_options     2005-03-25 01:09:27.000000000 +0100
@@ -56,4 +56,2 @@
-    "($of $oss)"{-C+,--context=-}'[output a context diff]:number of lines of copied context' \
-    "($of $oss)-c[output a context diff]" \
-    "($of $oss)"{-U+,--unified=-}'[output a unified diff]:number of lines of unified context' \
-    "($of $oss)-u[output a unified diff]" \
+    "($of $oss)"{-c-,-C+,--context=-}'[output a context diff]:number of lines of copied context' \
+    "($of $oss)"{-u-,-U+,--unified=-}'[output a unified diff]:number of lines of unified context' \



Messages sorted by: Reverse Date, Date, Thread, Author