You are not logged in.
This seems like a slightly odd problem. I've been using zsh quite happily for a while now and as far as I've been aware, my .zshrc has been loaded consistently and properly.
Today I decided to add auto-completion for one of my own programs. It works, BUT I have to manually `source ~/.zshrc` in each new terminal even after logging out and back in. The `fpath` variable is not being read from the .zshrc when I log in or start a terminal/emulator, but if I manually source .zshrc it works fine.
Here are the relevant files:
~/.zshenv
#!/bin/zsh
ZDOTDIR=~/.config/zsh
typeset -U path
path=($HOME/bin $HOME/scripts $path)
export EDITOR=vim
export DIRB=~/.local/share/DirB
export LOCAL_PACKAGE_SOURCES=/home/ian/dl
~/.config/_zshrc
# The following lines were added by compinstall
zstyle ':completion:*' completer _complete _ignored
zstyle :compinstall filename '/home/ian/.config/zsh/_zshrc'
autoload -Uz promptinit colors
colors
promptinit
# COMPLETION settings
fpath=(~/.config/zsh/completion $fpath)
autoload -Uz compinit
compinit
zstyle ':completion:*' menu select=2
# Lines configured by zsh-newuser-install
HISTFILE=~/.local/share/zshhistfile
HISTSIZE=1000
SAVEHIST=1000
if ! [[ "${PATH}" =~ "^${HOME}/bin" ]]; then
export PATH="${HOME}/bin:${PATH}"
fi
if ! [[ "${PATH}" =~ "^${HOME}/scripts" ]]; then
export PATH="${HOME}/scripts:${PATH}"
fi
# history options:
setopt append_history hist_ignore_dups hist_ignore_all_dups hist_ignore_space hist_no_store
# background jobs:
setopt notify
# changing directory:
setopt auto_cd auto_pushd pushd_silent
# globbing:
setopt extended_glob
# unset:
unsetopt beep flow_control
# keymap: emacs
bindkey -e
# End of lines configured by zsh-newuser-install
# make M-f and M-b stop at / in paths:
export WORDCHARS=''
source ~/.bash_profile
source ~/.config/bash/aliases
source ~/.config/zsh/alias_s
source ~/.config/zsh/alias_g
source ~/.config/bash/DirB
source ~/.config/zsh/functions
# prompt:
PS1="%B%{$fg[black]%}::%{$fg[cyan]%}(%b%{$fg[cyan]%}%n@%m%B%{$fg[cyan]%})%{$fg[black]%}-%{$fg[cyan]%}(%b%{$fg[cyan]%}%T%B%{$fg[cyan]%})%{$fg[black]%}-%{$fg[cyan]%}[%b%{$fg[cyan]%}%h%B%{$fg[cyan]%}]%{$fg[black]%}-%{$fg[cyan]%}(%b%{$fg[yellow]%}%2~%B%{$fg[cyan]%})%{$fg[black]%}>%b %{$reset_color%}"
The only changes I've made are the lines under "COMPLETION."
Can anyone spot something in there to suggest why everything seems to work except the `fpath=(~/.config/zsh/completion $fpath)` line?
Last edited by ibrunton (2015-06-09 22:43:24)
Offline
Read man zshcompsys and note the section about compinstall under INITIALIZATION.
Offline
Read man zshcompsys and note the section about compinstall under INITIALIZATION.
I did (and re-read it), but clearly I completely misunderstood it, because now none of my zsh config works unless I manually source it. I can't even get it to go back to the way it was. I have mucked something up pretty badly. I have no autocompletion at all, even for zsh builtins.
I'll come back when I get zsh working again.
Offline
This is what I use (note, different ZSHDOTDIR to you):
# completions
# add custom completion scripts
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit
compinit
zstyle ':completion:*' completer _complete _correct _approximate
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' completer _expand_alias _complete _approximate
zstyle ':completion:*' menu select
zstyle ':completion:*' file-sort name
zstyle ':completion:*' ignore-parents pwd
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:pacman:*' force-list always
zstyle ':completion:*:*:pacman:*' menu yes select
zstyle -e ':completion:*' hosts 'reply=(cent pi sent veles)'
zstyle :compinstall filename '$HOME/.zsh/zshrc'
Offline
Okay, everything's back AND my custom auto-completion is working.
The only thing I think I changed was that I created a symbolic link $ZDOTDIR/.zshrc -> $ZDOTDIR/_zshrc . I wouldn't have expected that to make a difference since I have the zstyle line pointing to the latter, but it seems to work now.
Marking solved, though I'm not sure what happened.
Offline