zsh + oh-my-zsh functions in function folder not found

Unlike commands and $path, it's not enough for a function to be in your $fpath. Before you can call your function, you need to first autoload it:

autoload -Uk run_after_save
  • -U prevents alias expansion when parsing the function.
  • -k turns on KSH_AUTOLOAD, which it looks like your function needs. For more info, see https://zsh.sourceforge.io/Doc/Release/Options.html#index-KSHAUTOLOAD. If your function needs KSH_AUTOLOAD to be off, then use -z instead.

Alternatively, you can just autoload all the functions from your functions dir, for example, inside your .zshrc file:

setopt EXTENDED_GLOB  # Enables ~ operator.
autoload -Uk $ZSH/functions/*~*.zwc  # Exclude compiled zsh byte code.

Note that for this to work, all the functions in the same dir should be written to expect KSH_AUTOLOAD to be set. If you have both ksh-style and zsh-style functions, then it's simpler to keep them in two separate dirs, so you can autoload the former with -k and the latter with -z. (Or even better, write your functions without KSH_AUTOLOAD, so you can always use -z.)