3

I've been having an issue with zsh completion that's becoming a rather large annoyance. It's completing options beyond where there is ambiguity. For example, in a directory with these files:

tilertest1x1-00_1408311424.log
tilertest1x1-00_1408311424.root
tilertest2x2-00_1408311501.log
tilertest2x2-00_1408311501.root
tilertest3x3-00_1408311527.log
tilertest3x3-00_1408311527.root

If I type "less ti" and then hit tab, zsh completes to this "tilertest-00_1408311." as opposed to stopping where I want it to ("tilertest"). Strangely, if I provide any kind of path (i.e. "less ./ti") it seems to work just fine. How can I change it to stop at the very first ambiguity? I've included my .zshrc file. I should also note I'm using oh-my-zsh.

# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="cmilke01"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Uncomment the following line to use case-sensitive completion.
 CASE_SENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

 # Uncomment the following line to disable colors in ls.
 # DISABLE_LS_COLORS="true"

 # Uncomment the following line to disable auto-setting terminal title.
 # DISABLE_AUTO_TITLE="true"

 # Uncomment the following line to disable command auto-correction.
  DISABLE_CORRECTION="true"

 # Uncomment the following line to display red dots whilst waiting for     completion.
 # COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-  zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)

source $ZSH/oh-my-zsh.sh

# User configuration

export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl"
# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
2

The option that controls a part of this behavior is menu_complete. So, you need:

unsetopt menu_complete

(but it appears that oh-my-zsh already does this). If this isn't sufficient, in case oh-my-zsh does anything special, you may also try:

zstyle ':completion:*' completer _complete
bindkey '\t' expand-or-complete

You can also compare the behavior with zsh -f and in the new shell:

autoload -U compinit
compinit
bindkey -e

If you get the incorrect behavior here, this is probably a bug in your zsh version. Otherwise, try to see which oh-my-zsh change (in its files) triggers the problem. Before hitting the Tab key, you can type CtrlX h in order to get context information on the following completion (this may help you to find what's going on).

Once you have found the solution, to make it permanent, put it in your .zshrc after any change done by oh-my-zsh, so typically at or near the end of the file.

  • Should I be adding this to my .zshrc file? I tried that, and it doesn't seem to have worked. – cmilke Sep 3 '14 at 9:29
  • oh-my-zshell still doesn't seem to work, but standard zsh does. As I'm using only the most minimalist features of zsh, I think I'm going to simply uninstall oh-my-zsh. Thank you for the help though. – cmilke Sep 4 '14 at 1:26

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.