Question: This works
----------

Normally, `zsh`'s tab completion works well.

```
$ touch foo-1-bar foo-2-bar
$ touch f<Tab>
$ touch foo--bar
            ^ cursor here

```

Pressing `Tab` again brings up a menu from which I can select files.

```
$ touch foo--bar
foo-1-bar  foo-2-bar

```

This doesn't
------------

However, this doesn't seem to work with strings where the beginning and end match. For example:

```
touch foo-bar foo-foo-bar
touch f<Tab>
touch foo-bar
         ^ cursor here. <tab> again.
touch foo-bar
              ^ cursor here.

```

No menu is brought up, and there is no opportunity to select `foo-foo-bar`. Is this expected behaviour or a bug? Is there a setting to make a menu appear in the latter scenario?

I'm using `oh-my-zsh`. I attempted removing all the completion-related lines from `~/.zshrc`, but this made no difference.

Answer: 
As per the comments, I tried disabling `oh-my-zsh`, which fixed this problem. I then went through the `oh-my-zsh` source, selectively disabling modules.

I previously had `CASE_SENSITIVE="true"`, but commenting out this line fixed it for me. Apparently it's a [known bug](https://github.com/robbyrussell/oh-my-zsh/issues/1398).

To fix it, I could put the following line in `~/.zshrc` after sourcing `oh-my-zsh`.

```
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'

```
Personally, I prefer this solution much more - <http://zsh.sourceforge.net/FAQ/zshfaq04.html#l50>,
It works like completion in tcsh, and completes words, that are before cursor only.

Just use

```
    bindkey '\CI' expand-or-complete-prefix

```

instead of

```
    bindkey '\CI' expand-or-complete

```

(Which is by default).