that should be correct, the autoload will be executed when you first invoke msg, have you tried invoking it? Il giorno lun 13 ago 2018 alle 15:50 TJ Luoma ha scritto: > I'm in the midst of an effort to try to learn some of zsh's more powerful > features, since I've been using zsh forever and feel like I only use 1% of > what it can do. > > One of the things that I've wanted to do for awhile is separate out some of > my more complex functions to remove them from my .zshrc file and put them > into their own files. This should make them easier to track/change/etc and > it makes things a lot easier to read and debug. > > Unfortunately, I can't seem to get it to work right. I'm sure I'm doing > something wrong because I don't really know what I'm doing, so I'll explain > what I've tried, and hopefully someone can explain where I've gone wrong. > > I added this to my .zshrc > > if [ -d "$ZDOTDIR/functions" ] > then > fpath=($ZDOTDIR/functions $fpath) > fi > > The goal there was to add '$ZDOTDIR/functions' to the functions list, which > I think is the right way to do this. > > I can verify that works, I think, by using 'echo $fpath': > > $ echo $fpath > /Users/luomat/Dropbox/dotfiles/zsh/completion > /Users/luomat/Dropbox/dotfiles/zsh/functions > /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions > /usr/share/zsh/5.3/functions > > /Users/luomat/Dropbox/dotfiles is my $ZDOTDIR > > The first file in '/Users/luomat/Dropbox/dotfiles/zsh/functions' is called > 'msg'. For simplicity's sake, let's assume the contents of 'msg' is simply > this: > > function msg { > > echo "$@" > > } > > (It's actually more complicated than that, but that's the overall idea.) > > I tried that, and then I tried > > autoload msg > > and I didn't get an error, but when I check 'which msg' I get this: > > msg () { > # undefined > builtin autoload -X > } > > so I've messed up something along the line. > > Any help would be appreciated. > > Thanks! > > Tj > > > -- > TJ Luoma > TJ @ MacStories > Personal Website: luo.ma (aka RhymesWithDiploma.com > ) > Twitter: @tjluoma > -- Pier Paolo Grassi