Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 want to add some rudimentary filename completion for programs like ghc, ghci (Haskell compilers), lyx (typesetting program), namely that hitting [tab] after one of the above should offer autocomplete suggestions for files ending in ".hs" or ".lyx".

What's the easiest way to do this in zsh?

share|improve this question
up vote 4 down vote accepted
compdef '_files -g "*.hs *.lyx"' ghc ghci lyx

See man zshcompsys | less -p '^\s*compdef \[' and generally man zshcompsys.

share|improve this answer
    
fantastic, thanks so much!! (The question was badly worded; I actually meant compdef '_files -g "*.hs"' ghc ghci; compdef '_files -g "*.lyx"' lyx) – gatoatigrado Jun 13 '11 at 17:27

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.