Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:

com.apple.AOSNotification.Accounts
com.apple.ATS
com.apple.ActivityMonitor
com.apple.AddressBook
com.apple.AddressBook.abd
com.apple.AddressBookSourceSync
com.apple.Aperture
com.apple.AppleShareClient
com.apple.Automator
com.apple.Automator.LSSharedFileList
com.apple.BezelServices
com.apple.BluetoothAudio
com.apple.CharacterPaletteIM
com.apple.Console
...

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.