Plugin doesn't start automatically as expected #75
Ok I think I might have found the problem, actually two problems. The first is that default value for AUTOSUGGESTION_HIGHLIGHT_COLOR of fg=8 is basically invisible in my solarized iTerm color scheme. The second problem, due to my little knowledge of ZSH and ZLE I suppose, is that zsh need to be loaded before the definition of zle-line-init to work.
Is my conclusion correct?
I'm having the same issue, requires me to manually run autosuggest-start
@hoodsy did you try the suggestion in my second comment? The snippet:
# Enable autosuggestions automatically.
zle-line-init() {
zle autosuggest-start
}
zle -N zle-line-initNeeds to be added after source $ZSH/oh-my-zsh.sh
Let me know if that helps.
Thanks for getting back so quickly! I did, but unfortunately it didn't have any effect.
I also get the annoying 'error' sound while typing... not sure the cause of this, although it IS autocompleting.
The beeping is configuration related, add setopt no_beep to your .zshrc and you should be good.
Can you share you .zshrc file so that I can have a look and maybe spot something?
Here it is:
# Path to your oh-my-zsh installation.
export ZSH=/Users/lbernard/.oh-my-zsh
# brew --prefix`/etc/profile.d/z.sh`
# Path to z.sh
. ~/z.sh
# 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="cobalt2"
# ZSH_THEME="sorin"
# ZSH_THEME="bira"
# ZSH_THEME="jnrowe"
ZSH_THEME="lukerandall"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="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 enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# load zsh-syntax-highlighting.
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Load zsh-autosuggestions.
source ~/.zsh/zsh-autosuggestions/autosuggestions.zsh
# Enable autosuggestions automatically.
zle-line-init() {
zle autosuggest-start
}
zle -N zle-line-init
AUTOSUGGESTION_HIGHLIGHT_COLOR="fg=8"
# 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)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git z node npm bower brew osx)
# User configuration
export PATH="/Users/lbernard/.npm-packages/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# export MANPATH="/usr/local/man:$MANPATH"
source $ZSH/oh-my-zsh.sh
# 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"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
zle -N zle-line-initSorry about all the comments. I hope this helps!
Try to move this whole entire part
# Enable autosuggestions automatically.
zle-line-init() {
zle autosuggest-start
}
zle -N zle-line-initafter
source $ZSH/oh-my-zsh.shAnd restart the shell
That worked! I guess I had only tried moving zle -N zle-line-init.
Thank you for the help. By the way, any idea the config item to change to prevent noises?
Yeah, I noticed that, my guess is that anything zle can happen only after oh-my-zsh.zsh is sourced.
Yes I posted it earlier. The option you have to set is no_beep so you add the following:
setopt no_beepTo your .zshrc you should be good to go. If that doesn't work then it's more likely an issue with the terminal you are using.
I hope it helps.
Hey there, anyone who can help with the issue I'm facing? Basically it seems there is no way I can get zsh-autosuggestions to work out of the box. I need to call autosuggestion-toggle via key bind everytime I start a session. Here is my current config file, anyone who can spot what am I doing wrong?
I'm running all the latest versions of zsh, oh-my-zsh and the tools required on OSX
Thanks a lot for your help.