Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to autocomplete an OS X defaults domain. I type:

$ defaults write <TAB>

And I get lot of results, as you might imagine:

Now, normally I might filter this list down by typing the first few letters of what I want and then completing again. Here, though, the interesting part of all of these is at the end of the word. I know the name of the application I'm looking for, which will be near the end of the word, but I'm not sure about the TLD that the full domain starts with (it might be a com, org, net, or something else).

Surely the great zsh has some way to filter this list using a regex or glob, but I can't find it. What's the trick?

share|improve this question
up vote 2 down vote accepted
setopt glob_complete

and perhaps tune other completion-related options. Then type defaults write *foo and press Tab.

share|improve this answer
Do you know if there's a way to make this case insensitive too? (like possible for file names) – slhck May 23 '12 at 21:10
@slhck zstyle ':completion:SOMETHING' matcher-list 'm:{[:lower:]}={[:upper:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}', usually. You need to look at the documentation (i.e. wade through the source) of this command's completion function to find what SOMETHING is. – Gilles May 23 '12 at 21:18
Perfect! Thank you! – Peeja May 24 '12 at 13:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .