Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1808304
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:14:42+00:00 2026-05-17T06:14:42+00:00

Zsh completion is a rather complex beast, and I find the man-page very difficult

  • 0

Zsh completion is a rather complex beast, and I find the man-page very difficult to read, especially it’s missing (simple) examples of all the various optspec forms etc. I haven’t managed to find anything online myself yet so help would be most appreciated.

As an example here’s what I’m struggling with at the moment, and the zshcompsys man-page doesn’t offer any clarifications. I have

#compdef mtt2

_arguments -s : \
    '-h' '--help' \
    '-V' '--version' \
    ':foobars:(foo bar baz)'

Now, when I type mtt2 <TAB> I’m only offered foo, bar and baz as completions, why not -h, --help, etc, as well?
What magic do I need to pass to _arguments in order to be offered all possibilities?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:14:43+00:00Added an answer on May 17, 2026 at 6:14 am

    You need to start argument that you complete with dash (I mean that argument that you type to test, not _arguments argument). You should either look at zstyle, try to pass -h and others just like :foobars: or even directly use compadd. Examples:

    1. Directly using compadd:
      #compdef test
      A=( -h --help -V --version foo bar baz )
      compadd -a A
      
    2. Passing -h and others just like :foobars::
      #compdef test
      A=( -h --help -V --version )
      _arguments \
          - foobars \
          ':foobars:(foo bar baz)' \
          - options \
          ":arguments:($A)"
      

      or

      A=( -h --help -V --version foo bar baz )
      _arguments \
          ":::($A)"
      
    3. zstyle controls completion style. It is described in «COMPLETION SYSTEM CONFIGURATION» section in man zshcompsys and probably has an option that will enable completing of switches, but I do not know which option controls that.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I configure the Zsh tab-completion such that when I type cd ..<TAB>
I get the following in including MacPorts' Bash tab completion to Zsh /opt/local/etc/bash_completion:[:48: unrecognized
I have not found a tab-completion script for RubyGem in Bash/Zsh. Where can you
I have a Bash tab-completion script for Apache's Hadoop. Normally, I use zsh as
Zsh has the following keyboard shortcut for Man Esc + h I would like
In zsh, how do I pass anonymous arrays into functions? e.g. looking for something
How can I get tab completion to work for selecting CVS modules under Linux
Problem: to have a tab completion which takes two words and calculates the best
I put unsuccessfully Zsh installed by MacPorts as my login shell by setting the
Zsh manual mentions that option -a means ALL_EXPORT , ALL_EXPORT (-a, ksh: -a) All

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.