I've just started using the Command-T plugin for vim, and it rocks. In case you haven't heard of it, it allows you to type something like this:


to select Something.hs-boot from the list


And so on.

I was wondering if I could use a similar autocompletion style with zsh. I understand that the shell completion couldn't be nearly as extensive as the vim completion because the shell complition probably shouldn't be searching the entire system every time you type a letter, but is there some sort of similar completion where I could at least type


and get an effect similar to the one above?

I've heard that zsh has a pretty well-programmable autocomplete functionality, but my shell-fu is fairly weak.

Anybody know how to set this up?


To complete partial paths, it's enough to just init the completion system (at least on my system, using zsh v4.3.17):

autoload -U compinit && compinit
zmodload zsh/complist

If you want to get a little more fancy, you can make the matching case-insensitive:

zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

Update 1:

I don't know if you can do Command-T-style autocompletion ... but as zsh has to get all matches before it displays something, doing this on-the-fly, especially somewhere that has a lot of subdirectories/files, might not be feasible.

You could however use:

**/*thing <Tab>

The ** matches all files & subdirectories of the current directory.

Idea: If it does not have to be an up-to-date list of files, you could potentially write a completion function that uses the output of locate (i.e. a pre-computed file list)

Update 2: https://github.com/junegunn/fzf#fuzzy-completion-for-bash-and-zsh


Another interesting alternative is to use something like fasd.

  • I second the recommendation for fasd. With fasd, you could simply type v Sb and it would open the file matching 'Sb' best in vim, according to time elapsed and frequency of edits of that file.
    – simonair
    Feb 9 '13 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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