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

  • Home
  • SEARCH
  • 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 7944383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:32:12+00:00 2026-06-04T00:32:12+00:00

What I want: cd c/ra<tab> completes to ~/code/rails-app and cd c/<tab> shows a list

  • 0

What I want:

cd c/ra<tab> completes to ~/code/rails-app and cd c/<tab> shows a list of dirs within ~/code

What I currently have:

c ra<tab> completes to c rails-app if I have a directory ~/code/rails-app and c <tab> shows a list of dirs within ~/code

By having this in my .zshrc:

c() { cd ~/code/$1; }
_c() { _files -W ~/code -/; }
compdef _c c

This tool looks promising: https://github.com/flavio/jump but I’d like something more lightweight.

  • 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-06-04T00:32:13+00:00Added an answer on June 4, 2026 at 12:32 am

    Tab completion such as you’ve described, at least for directories, should be doable by zsh without the need to write a zsh function.

    This link, for example, notes that typing /u/l/b then tab expands to /usr/local/bin on the prompt.

    This works for me – if I make a directory ~/code/rails-app such:

    zsh% ls ~/code
    another-app       another-dir rails-app
    zsh% ls ~/code/rails-app
    one two
    

    then:

    zsh% cd c/ra<TAB> # this expands to 'cd code/rails-app'
    zsh% cd c/<TAB><TAB> # Double tab, one to expand "c" to "code", 
    zsh% #               # second gives me the zsh-completion menu
    

    I can’t point out which zsh option this is – I’m using a fairly heavily modified ~/.zshrc and bits of oh-my-zsh. This might be functionality given by zsh without needing to be enabled; if not, details in either the first link or somewhere in oh-my-zsh or even some version of the ZSH manual should help. (I find the manual a little … overwhelming, to say the least, though).

    I don’t believe that you need to write a function to achieve this behaviour – zsh is definitely able to do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a tab/widget/thingymajiggy like the feedback-thing in this picture: That behaves
I have an app based on a tab bar and data retrieved from the
I want to adjust zsh so that I can tab complete: myprog <tab> using
I want a tab control to dock to the entire window panel, in Qt
I want to get tab Index with it's id. My tabs are in a
What I need to achieve is that in every Tab I want to display
I am using extjs 4.0.7. I want to disabled tab and Enter key event
I want to click a tab on the following page using jQuery (or at
I want to create a tab menu similar to TabHost but I would like
I want to add a tab to a certain tab bar from inside the

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.