Tab doesn't auto complete any more. #25

Closed
gregwym opened this Issue Apr 24, 2014 · 4 comments

5 participants

@gregwym

Hi @tarruda,

First of all, this looks great! Thanks for creating it.

My problem is, after I enable this plugin, the native zsh auto completion stop working.
For example, when I cd to some dir and click tab for some dir name suggestion, it won't show up any more.

The suggestion by zsh-autosuggestions can not be accepted by the tab key as well. They just disappears after i click tab.

Here is my .zshrc, maybe helpful for identifying the problem.

# Path to your oh-my-zsh configuration.
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="mytheme"

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

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"

# Uncomment 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"

# 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 osx autojump brew node npm pip pod sublime)

source $ZSH/oh-my-zsh.sh

# Config history
setopt hist_ignore_all_dups
setopt hist_ignore_space

# Autojump init
# [[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh
autoload -U compinit && compinit

# rbenv
eval "$(rbenv init -)"


# Setup zsh-autosuggestions
source ~/.zsh-autosuggestions/autosuggestions.zsh

# Enable autosuggestions automatically
zle-line-init() {
    zle autosuggest-start
}
zle -N zle-line-init

# use ctrl+t to toggle autosuggestions(hopefully this wont be needed as
# zsh-autosuggestions is designed to be unobtrusive)
bindkey '^T' autosuggest-toggle

@CWSpear

I'm having this issue, too. I am okay with tab not going to the end. I can use ^E to jump to the end of the line and accept the suggestion and ^F to jump to the next work.

But tabbing should still suggest something. I type cd ~/somed for somedirectory, but all that shows up is somedumbdirectory and it goes away when you hit tab. Super frustrating when you remember the start of the name of a directory but can't remember it.

Using the ^T thing to toggle it off doesn't bring back the old suggestion system either :-(

I tried disabling zsh-history-substring-search (and indeed, I did need to source it first to work at all).

The goal would for it to be similar to fish.

Here's my .zshrc (using antigen):

# start antigen

source $HOME/.antigen.zsh

# Load the oh-my-zsh's library.
antigen use oh-my-zsh

# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle command-not-found

# Fish-like bundles
antigen bundle zsh-users/fizsh
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-history-substring-search
antigen bundle tarruda/zsh-autosuggestions

# Load the theme.
antigen theme apple

# Tell antigen that you're done.
antigen apply

# end antigen


# history-substring-search config
# bind UP and DOWN arrow keys
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down

ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)


# autosuggestions config
# Enable autosuggestions automatically
zle-line-init() {
    zle autosuggest-start
}
zle -N zle-line-init
bindkey '^f' vi-forward-blank-word
bindkey '^T' autosuggest-toggle
@JeffChien

Comment the line in you zshrc COMPLETION_WAITING_DOTS="true", your tab function will back.
when this option is true, oh-my-zsh will create a wrapper for zle widget expand-or-complete called expand-or-complete-with-dots in oh-my-zsh/lib/completion.zsh

back to the repo, expand-or-complete-with-dots is not list in the ZLE_AUTOSUGGEST_COMPLETION_WIDGETS array, so the zle alias hook can not be trigger, this is why tab doesn't complete anything.

but there's a problem I don't know how to fix, not familiar with zsh script, if I add expand-or-complete-with-dots to the array manually, the hook is triggered, but it cause endless recursive, because
it's a wrapper of expand-or-complete, and is listed in ZLE_AUTOSUGGEST_COMPLETION_WIDGETS...

@k4nar

@JeffChien : I'm having the same trouble but adding COMPLETION_WAITING_DOTS="true" to my .zshrc doesn't solve it. Did I miss something ?

@faceleg

This solved the issue for me. Added note about this in d76af3c

@faceleg faceleg closed this Dec 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment