Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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'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?

share|improve this question
up vote 1 down vote accepted

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)

share|improve this answer

Another interesting alternative is to use something like fasd.

share|improve this answer
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .