allow overriding lib/*.zsh in custom/lib
Merge pull request #3344 from wrboyce/custom-lib

allow overriding lib/*.zsh in custom/lib
Refactor similar functions into common sections
Fix take function

Before the modification, the `take` function will try to cd
into the created directory even if mkdir throws an error.

With this modification, if mkdir fails to create the directory,
cd won't run and the take function will return the mkdir exit
code.