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

Re: auto-completion with exact match



On Nov 23, 10:24am, Kazuo Teramoto wrote:
}
} > % ln <ctrl-x>h
} Produce a list of options to complete like ls. With and without a
} start arg (e.g. with 'ln win' I get a list 'wine winet' and can cycle
} between the options)

No, you misunderstand.  I mean really do type a control-x and an h.
You should see something like this:

% ln
tags in context :completion::complete:ln::
    globbed-files  (_files _default (eval))
% rm
tags in context :completion::complete:rm::
    argument-rest options  (_arguments _rm (eval))

I just realized that when I looked at this before, I was using an
older version of zsh.  There now is a completion function _rm, and
I'm able to reproduce the behavior you described.  This function
was introduced at the beginning of October of this year.

The fix seems to be to change the direct call to _path_files in _rm
to instead call _files and let it manage looping on _path_files.

--- ../zsh-forge/current/Completion/Unix/Command/_rm    2008-10-08
04:37:34.000000000 -0700
+++ Completion/Unix/Command/_rm 2008-11-23 10:03:34.000000000 -0800
@@ -34,7 +34,7 @@
   (file)
     declare -a ignored
     ignored=(${line//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
-    _path_files -F ignored && ret=0
+    _files -F ignored && ret=0
     ;;
 esac
 



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