1

Currently using ZSH with prezto on OSX (10.10.3) and I am having issues with the tab completion. I have always been able to hit the tab key after typing either:

 $ cd ~
 $ cd ~/

and I would get a directory menu with the contents of my users home folder.
For some reason after hitting tab I get:

 $ cd ~
 -- named directory --
_comp_dumpfile
 -- user --
Guest          cr85ir3        macprod-pc  root

This is the result of typing cd ~/ and pressing tab

 $ cd ~//Users/CR85IR3/

I have tried disabling autonamedirs and cdablevars. Also reinstalled prezto and tried using /usr/local/bin/zsh which is the latest zsh installed by homebrew.

Would really appreciate some help, Thanks

Edit #1
Seperated the output and added prezto config below.

.zpreztorc

#
# Sets Prezto options.
#
# Authors:
#   Sorin Ionescu <sorin.ionescu@gmail.com>
#

#
# General
#

# Set case-sensitivity for completion, history lookup, etc.
# zstyle ':prezto:*:*' case-sensitive 'yes'

# Color output (auto set to 'no' on dumb terminals).
zstyle ':prezto:*:*' color 'yes'

# Set the Zsh modules to load (man zshmodules).
# zstyle ':prezto:load' zmodule 'attr' 'stat'

# Set the Zsh functions to load (man zshcontrib).
# zstyle ':prezto:load' zfunction 'zargs' 'zmv'

# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'directory' \
  'spectrum' \
  'utility' \
  'completion' \
  'homebrew' \
  'osx' \
  'git' \
  'syntax-highlighting' \
  'history-substring-search' \
  'prompt'

#
# Editor
#

# Set the key mapping style to 'emacs' or 'vi'.
zstyle ':prezto:module:editor' key-bindings 'emacs'

# Auto convert .... to ../..
# zstyle ':prezto:module:editor' dot-expansion 'yes'

#
# Git
#

# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'.
# zstyle ':prezto:module:git:status:ignore' submodules 'all'

#
# GNU Utility
#

# Set the command prefix on non-GNU systems.
# zstyle ':prezto:module:gnu-utility' prefix 'g'

#
# History Substring Search
#

# Set the query found color.
# zstyle ':prezto:module:history-substring-search:color' found ''

# Set the query not found color.
# zstyle ':prezto:module:history-substring-search:color' not-found ''

# Set the search globbing flags.
# zstyle ':prezto:module:history-substring-search' globbing-flags ''

#
# Pacman
#

# Set the Pacman frontend.
# zstyle ':prezto:module:pacman' frontend 'yaourt'

#
# Prompt
#

# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
zstyle ':prezto:module:prompt' theme 'paradox'

#
# Ruby
#

# Auto switch the Ruby version on directory change.
# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes'

#
# Screen
#

# Auto start a session when Zsh is launched in a local terminal.
# zstyle ':prezto:module:screen:auto-start' local 'yes'

# Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:screen:auto-start' remote 'yes'

#
# SSH
#

# Set the SSH identities to load into the agent.
# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github'

#
# Syntax Highlighting
#

# Set syntax highlighters.
# By default, only the main highlighter is enabled.
 zstyle ':prezto:module:syntax-highlighting' highlighters \
   'main' \
#   'brackets' \
#   'pattern' \
#   'cursor' \
#   'root'
#
# Set syntax highlighting styles.
# zstyle ':prezto:module:syntax-highlighting' styles \
#   'builtin' 'bg=blue' \
#   'command' 'bg=blue' \
#   'function' 'bg=blue'

#
# Terminal
#

# Auto set the tab and window titles.
 zstyle ':prezto:module:terminal' auto-title 'yes'

# Set the window title format.
# zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s'

# Set the tab title format.
# zstyle ':prezto:module:terminal:tab-title' format '%m: %s'

#
# Tmux
#

# Auto start a session when Zsh is launched in a local terminal.
# zstyle ':prezto:module:tmux:auto-start' local 'yes'

# Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:tmux:auto-start' remote 'yes'

# Integrate with iTerm2.
# zstyle ':prezto:module:tmux:iterm' integrate 'yes'  

which _cd

❯ which _cd                                                                                                                                                           [17:55:01]
    _cd () {
        _cd_options () {
            _arguments -s '-q[quiet, no output or use of hooks]' '-s[refuse to use paths with symlinks]' '(-P)-L[retain symbolic links ignoring CHASE_LINKS]' '(-L)-P[resolve symbolic links as CHASE_LINKS]'
        }
        setopt localoptions nonomatch
        local expl ret=1 curarg
        integer argstart=2 noopts
        if (( CURRENT > 1 ))
        then
            while [[ $words[$argstart] = -* && argstart -lt CURRENT ]]
            do
                curarg=$words[$argstart]
                [[ $curarg = -<-> ]] && break
                (( argstart++ ))
                [[ $curarg = -- ]] && noopts=1  && break
            done
        fi
        if [[ CURRENT -eq $((argstart+1)) ]]
        then
            local rep
            rep=(${~PWD/$words[$argstart]/*}~$PWD(-/))
            rep=(${${rep#${PWD%%$words[$argstart]*}}%${PWD#*$words[$argstart]}})
            (( $#rep )) && _wanted -C replacement strings expl replacement compadd -a rep
        else
            if [[ "$PREFIX" = (#b)(\~|)[^/]# && ( -n "$match[1]" || ( CURRENT -gt 1 && ! -o cdablevars ) ) ]]
            then
                _directory_stack && ret=0
            fi
            local -a tmpWpath
            if [[ $PREFIX = (|*/)../* ]]
            then
                local tmpprefix
                tmpprefix=$(cd ${PREFIX%/*} >&/dev/null && print $PWD)
                if [[ -n $tmpprefix ]]
                then
                    tmpWpath=(-W $tmpprefix)
                    IPREFIX=${IPREFIX}${PREFIX%/*}/
                    PREFIX=${PREFIX##*/}
                fi
            fi
            if [[ $PREFIX != (\~|/|./|../)* && $IPREFIX != ../* ]]
            then
                local tmpcdpath alt
                alt=()
                tmpcdpath=(${${(@)cdpath:#.}:#$PWD})
                (( $#tmpcdpath )) && alt=('path-directories:directory in cdpath:_path_files -W tmpcdpath -/')
                if [[ -o cdablevars && -n "$PREFIX" && "$PREFIX" != <-> ]]
                then
                    if [[ "$PREFIX" != */* ]]
                    then
                        alt=("$alt[@]" 'named-directories: : _tilde')
                    else
                        local oipre="$IPREFIX" opre="$PREFIX" dirpre dir
                        dirpre="${PREFIX%%/*}/"
                        IPREFIX="$IPREFIX$dirpre"
                        eval "dir=( ~$dirpre )"
                        PREFIX="${PREFIX#*/}"
                        [[ $#dir -eq 1 && "$dir[1]" != "~$dirpre" ]] && _wanted named-directories expl 'directory after cdablevar' _path_files -W dir -/ && ret=0
                        PREFIX="$opre"
                        IPREFIX="$oipre"
                    fi
                fi
                [[ CURRENT -ne 1 || ( -z "$path[(r).]" && $PREFIX != */* ) ]] && alt=("${cdpath+local-}directories:${cdpath+local }directory:_path_files ${(j: :)${(@q)tmpWpath}} -/" "$alt[@]")
                if [[ CURRENT -eq argstart && noopts -eq 0 && $PREFIX = -* ]] && zstyle -t ":completion:${curcontext}:options" complete-options
                then
                    alt=("$service-options:$service option:_cd_options" "$alt[@]")
                fi
                _alternative "$alt[@]" && ret=0
                return ret
            fi
            [[ CURRENT -ne 1 ]] && _wanted directories expl directory _path_files $tmpWpath -/ && ret=0
            return ret
        fi
    }
YuujM
  • 23
  • 4
  • Did you get same result as you show above when `cd ~/`? Also what have you enabled in you prezto setup? please paste your `~/.zpreztorc` in your question – number5 May 14 '15 at 01:22
  • 1
    This will be basically impossible to debug without your complete setup. Can you focus on what has changed, which would be much more productive? You said "I have always been..." then "for some reason...", so what changed? Did you pulled in some Prezto commits from upstream (which shouldn't cause any problem per se since I have all upstream commits in my fork)? Did you install some plugin? And you might want to do `_cd; which _cd` to have a look at your completion function. – 4ae1e1 May 14 '15 at 17:08
  • @4ae1e1 I'm not sure what changes caused this but it seems to have started after updating to OSX 10.10.3 and installing prezto. I tried pulling prezto to reset my configuration but it did not help. The only other thing I added around the same time was a few .nanorc files for nano syntax highlighting which I removed to make sure that wasn't the cause. – YuujM May 19 '15 at 00:42
  • 1
    You mean it worked *before* you installed Prezto? Oh well, when you install a new configuration framework of course you have to make sure it's compatible with your existing stuff. This won't happen with vanilla Prezto. And whatever rc files your've got has nothing to do with Zsh at all. What you should do is to disable things component by component and find out what's wrong. – 4ae1e1 May 19 '15 at 00:49
  • Also, did you do `_cd; which _cd` as I recommended you to? – 4ae1e1 May 19 '15 at 00:51
  • @4ae1e1 I am copying the output from `which _cd` to my original question above. I also tested this in bash and using `cd ~/` and hitting tab key (twice) does list the contents of the home folder but `cd ~` and tab key (twice) lists a bunch of named directories with an underscore `~_calendar, ~_ftp, etc` as well as user directories without the underscore `~Guest`. Thanks, I appreciate your help. – YuujM May 19 '15 at 01:04
  • Bash and Zsh use completely separate completion systems. `cd ~` *should* list user expansions in vanilla Prezto; that's not the problem. But `cd ~/` shouldn't complete to `cd ~//Users/CR85IR3/`. – 4ae1e1 May 19 '15 at 01:08
  • I see, I wasn't sure if Bash was supposed to list the directories prefixed with `~_` – YuujM May 19 '15 at 01:13
  • Your completion function looks normal. Not sure what's wrong. As I said, if I were you I would disable everything non-Prezto first (check `~/.zshenv`, `~/.zshrc`, `~/.zprofile`, `~/.zlogin` and their `/etc` relatives) and enable things one by one to see at which step it goes wrong. – 4ae1e1 May 19 '15 at 01:18
  • @4ae1e1 Is there any configurations or plugin that could still be enabled after pulling fresh prezto dotfiles? I will try to use the defaults again but last time I tried this it didn't help. – YuujM May 19 '15 at 01:32
  • Well, I was just trying to provide some debugging suggestions. Anything from Prezto shoulgn't conflict with each other (especially not on OS X, which seems to be the primary platform of the maintainer, among many others, me included), although there are some module ordering that should be respected. If you want to be extra safe, use the rc files from Prezto's `runcoms` directory first (of course you should back up your own rcs before replacing them). In particular, you should disable your personal customizations first. – 4ae1e1 May 19 '15 at 01:54
  • If you start with a fresh Prezto install with the default configs and still see the problem (as you seemed to suggest in your last comment), well, then something might be seriously off, and you might want to report an issue https://github.com/sorin-ionescu/prezto/issues – 4ae1e1 May 19 '15 at 01:55
  • @4ae1e1 I tried a fresh Prezto install and I am still getting the same result. I think it may be a ZSH or OSX issue since OSX was updated recently – YuujM May 19 '15 at 22:03
  • What version of Zsh are you using? I use `/bin/zsh` (`zsh 5.0.5 (x86_64-apple-darwin14.0)`) shipped with OS X 10.10.3. Never had a problem. – 4ae1e1 May 19 '15 at 22:06
  • @4ae1e1 I was using `/bin/zsh ( zsh 5.0.5 (x86_64-apple-darwin14.0) )` when this issue started and installed `zsh 5.0.7 (x86_64-apple-darwin14.0.0)` using Homebrew to see if it would help. Unfortunately they both have the same issue – YuujM May 19 '15 at 22:31

0 Answers0