diff options
-rw-r--r-- | user/.zshrc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/user/.zshrc b/user/.zshrc index 6b9a95c..c3548b8 100644 --- a/user/.zshrc +++ b/user/.zshrc @@ -1,15 +1,25 @@ function __source_startup_files() { # source the global configution file - local file="/etc/zshrc" + local __source_file="/etc/zshrc" - if [ -r "$file" ]; then - source "$file" + if [ -r "$__source_file" ]; then + source "$__source_file" + fi + + local __source_dir + + if [ -n "$ZDOTDIR" ]; then + __source_dir="$ZDOTDIR/.zsh" + elif [ -n "$HOME" ]; then + __source_dir="$HOME/.zsh" + else + return fi # source every file readable in .zsh - for file in $(find ".zsh" -type f -readable); do - source "$file" + for __source_file in $(find "$__source_dir" -type f -readable); do + source "$__source_file" done } |