Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I'm using oh-my-zsh on Mac OS X with homebrew'ed zsh 4.3.12. I stumbled recently on a weird problem. In scripts/not-used I have several .R files:

breakdowns.R             eventloop.R              process-largeclients.R   process-qt.R
reprocess-pinning.R      calculate-qt-error.R     generate_decision_tree.R process-net.R

However, when I try ls scripts/not-used/+Tab the first completion is ls scripts/not-used/_.R where _ represents cursor position. If I press Tab again, I get this weird completion:

$ ls scripts/not-used/.R                                                                          
breakdowns.R  eventloop.R

How to unset this ugly (wrong) behaviour?

The options that are set are:

alwaystoend autocd autonamedirs autopushd cdablevars completeinword
correctall extendedglob extendedhistory noflowcontrol
histexpiredupsfirst histignoredups histignorespace histreduceblanks histverify
interactive login longlistjobs monitor promptsubst 
pushdignoredups pushdminus pushdsilent pushdtohome
sharehistory shinstdin zle
share|improve this question
how is breakdowns.R eventloop.R incorrect completion? Try unsetting the completeinword option, as this allows completion to be done from both ends of the cursor, left and right. That means, that if I type pac as in pacman, and there's a command called arpac, then arpac will be in the list of completions, since completion occurs on both sides of the cursor instead of only to the right. – Alexej Magura Dec 23 '13 at 16:53
I wasn't aware of the question... So, breakdowns.R eventloop.R is an incorrect completion, in the sense of incompleteness. If you look closely at the list of files, there are more than just those 2, ending with .R. – Nikola Knezevic Jul 21 '14 at 6:57
I tried touching into existence a bunch of files with the same names as the ones you listed as well as a z.R, a z,.R and a z_test.R for testing purposes - z_test.R wouldn't show up trying to autocomplete it, but z,.R would. Guessing it's some kind of regex mishap – Dmitri DB Sep 15 '14 at 19:13
This may be related to, which is an old issue, but the latest version has similar completion code. I did not attempt work-arounds to confirm. – rjewell Dec 16 '14 at 17:38

3 Answers 3

Did you notice where it put your cursor? Since all files end with .R, it's automatically appending the possible suggestion for you.

The autocomplete is using "both ends" as described by Tshepang.

Try dropping a file into this folder without a .R name, and you'll see that .R bit go away.

Honestly, autocomplete actually needs something to "complete" not a blind directory assumption.

share|improve this answer

The problem lies with the zstyle for matcher-list.

If you add the following to your .zshrc, it will fix it:

zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'e:|[._-]=* e:|=*' 'l:|=* e:|=*'

The e: (instead of the default r:) force the match to the end of the string.

The details for the options can be found in the ZSH: Completion Matching Control docs

share|improve this answer

Gert may well be right for the fix. However, I suspect the reason for the incomplete nature of the list of files (breakdowns.R and eventloop.R) is due to those files being the only files in the current working directory that are marked as executable. You can confirm this with an "ls -l" and look at the permissions for something like rwx. If you do not have "./" or that directory explicitly in PATH then I would expect those two files not to appear either.

 8 -rwxr--r-- 1 userbob    groupbob      4420 May 28 15:55 filebob.R
share|improve this answer

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.