automatically get DOTFILES_PATH

This commit is contained in:
Dmytro Meleshko 2018-11-10 16:51:47 +02:00
parent a523ed910d
commit 6fcb6b0750
4 changed files with 18 additions and 21 deletions

View file

@ -12,7 +12,6 @@ for zsh_file_name in z{shenv,shrc,login}; do
cat > "$zsh_file" <<EOF cat > "$zsh_file" <<EOF
#!/usr/bin/env zsh #!/usr/bin/env zsh
export DOTFILES_PATH="$PWD" source "$PWD/$zsh_file_name"
source "\$DOTFILES_PATH/$zsh_file_name"
EOF EOF
done done

6
zlogin
View file

@ -1,5 +1,5 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
if [[ -n "$DOTFILES_PATH" ]]; then DOTFILES_PATH="${0:h}"
python "$DOTFILES_PATH/welcome/main.py"
fi python "$DOTFILES_PATH/welcome/main.py"

14
zshenv
View file

@ -1,10 +1,8 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
if [[ -n "$DOTFILES_PATH" ]]; then DOTFILES_PATH="${0:h}"
for script in functions path exports; do
source "$DOTFILES_PATH/lib/$script.zsh" for script in functions path exports; do
source_if_exists "$DOTFILES_PATH/custom/$script.zsh" source "$DOTFILES_PATH/lib/$script.zsh"
done source_if_exists "$DOTFILES_PATH/custom/$script.zsh"
else done
echo "please, set DOTFILES_PATH to the path to your dotfiles directory" >&2
fi

16
zshrc
View file

@ -1,11 +1,11 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
if [[ -n "$DOTFILES_PATH" ]]; then DOTFILES_PATH="${0:h}"
for script in oh-my-zsh aliases widgets theme; do
source "$DOTFILES_PATH/lib/$script.zsh"
source_if_exists "$DOTFILES_PATH/custom/$script.zsh"
done
run_before rbenv 'eval "$(rbenv init -)"' for script in oh-my-zsh aliases widgets theme; do
run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"' source "$DOTFILES_PATH/lib/$script.zsh"
fi source_if_exists "$DOTFILES_PATH/custom/$script.zsh"
done
run_before rbenv 'eval "$(rbenv init -)"'
run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"'