Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Eclipse and Resharper have a nice way of navigating files.

If I have the following folders (or files) in my current directory


In eclipse I can navigate to them by using only the capitalized letters. Correspondingly in zsh I want to be able to type:

cd MRLAFN(Tab)(Enter)

To get into MyReallyLongAndFunName in one step

If I want to do that with zsh right now, I have to type My(Tab)Fun(Tab)(Enter)

share|improve this question
up vote 2 down vote accepted

This works for me:

zstyle ':completion:*' matcher-list 'r:[^A-Z0-9]||[A-Z0-9]=** r:|=*' 

Then I can do this in a test directory:

touch MyReallyLongName MyReallyLongAndFunName MyReallyLongAndNotReallyFunName
ls MyReallyLongAndNotReallyFunName

I cobbled it together from tips in the Zshell User's Guide.

share|improve this answer
Can you please describe where I have to place this extension (file, folder)? You might also be interested in adding it to the zsh-completions project. – JJD Jun 12 '14 at 15:46

I got this to work "quite well" by adding a file _camel_case to my personal ~/.zsh/functions folder (take any folder that is in your $fpath variable) with the following content:


[[ -z "$PREFIX" ]] && return 1

relpath=$(dirname $PREFIX)

[[ -e $relpath ]] || return 1

files=$(ls $relpath)

regex=$(echo $(basename $PREFIX) | sed -e 's/\([A-Z][^A-Z]*\)/\1[^A-Z]+/g')

correctedfiles=($(echo $files | grep -P $regex | sed -e :a -e '$!N;s/\n/ /;ta'))

results=($(for file in $correctedfiles; do echo "$relpath/$file"; done))

compadd -U -f -- $results

Then, I added the following line to my ~/.zshrc

zstyle ':completion:*' completer _complete _correct _path_files _camel_case

Note that this is most probably not a "good" solution as I do not have too much knowledge of the completion system of zsh (only few people really have, I guess), but it does exactly what you described in your question.

share|improve this answer
This only somewhat works.. mkdir AaBbCcDd cd ABCD (tab) => cd ./ ie. Autocomplete fails – Rohit Manokaran Apr 12 '12 at 19:32

Your Answer


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.