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.

Assume there are three dirs: abc adc aec

I want to type cd dc, press Tab and get cd adc (trailing / is not important) completion.

Is it possible? What is the simplest way to achieve this behaviour?

I can move cursor to d inside dc and then press Tab, zsh will complete; but this is not convenient at all.

share|improve this question
add comment

1 Answer 1

In your ~/.zshrc:

  1. Make sure you're enabling compinit:

    autoload -U compinit
    compinit -i
    
  2. Enable tab-completion in-word:

    setopt complete_in_word
    
  3. Shift the cursor to the end of the word after tab-completion.

    setopt always_to_end
    

Those four lines (or even just [1] and [2]) were all I needed in an empty ~/.zshrc to enable this behaviour.

share|improve this answer
add comment

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.