Results 1 to 2 of 2
I have a file called precmd in ~/.zfunctions that contains
Code:
echo "hello"
My zshenv file should automatically autoload this for me, but it doesn't seem to be working. Why ...
- 04-24-2007 #1Just Joined!
- Join Date
- May 2006
- Posts
- 53
Problem loading functions in ZSH
I have a file called precmd in ~/.zfunctions that contains
My zshenv file should automatically autoload this for me, but it doesn't seem to be working. Why is this? (~/.zshenv below)Code:echo "hello"
'precmd' gets printed yet I don't get a nice little 'hello' before every prompt why is this?Code:## set debug variables debug="echo" debug=":" ## set default zsh config directory export ZDOTDIR=$HOME ## source .zshrc if it exists if [[ -r $ZDOTDIR/.zshrc ]]; then source $ZDOTDIR/.zshrc fi ## set env-ariables export PS1=$'%{\e[0;32m%}%U%n@%m%u:%~%(!.#.$)%{\e[0m%} ' ## add ~/bin to path should it exist typeset -U path if [[ -d $HOME/bin ]]; then path=($HOME/bin $path) fi ## add directories for custom functions typeset -U fpath fpath=(/etc/zsh/functions $ZDOTDIR/.zfunctions $fpath) ## autoload all the files in all the directories of fpath that are not empty $debug -e "\nlooping through dirs in fpath\n" for dir in $fpath; do $debug -e "\nif dir isn't empty...\n" if [[ $((`ls -a|wc -l` - 2)) -gt 0 ]]; then $debug -e "\nautoload functions\n" for func in `ls -a $dir`; do [[ ! -d $dir/$func ]] && autoload $func && $debug "autoloading: $func" done fi done
- 04-25-2007 #2Just Joined!
- Join Date
- May 2006
- Posts
- 53
Update:
Ok, it is working. When I open the terminal the functions have been autoloaded and I get a nice little 'hello' before each prompt. Problem is if I change it to goodbye and type source ~/.zshenv nothing changes, but if I close the terminal and start a new one, it works. How do I fix this?


Reply With Quote