Created
August 10, 2024 05:44
-
-
Save lispstudent/4f5932739d345e6e1ed02b72a2d25463 to your computer and use it in GitHub Desktop.
zpresto-install.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
################################################################################ | |
# 2024-08-08 | |
# Install zsh's prezto to a user's $HOME | |
################################################################################ | |
DIRECTORY="~/.config" | |
# append "/" to make user $DIRECTORY is a dir, not a file. | |
# make it explicit here, to be aware of it. | |
if [ ! -d "$DIRECTORY/" ] ; then mkdir "$DIRECTORY" ; fi | |
export XDG_CONFIG_HOME="$HOME/.config" | |
export ZDOTDIR="$XDG_CONFIG_HOME/zsh" | |
#echo $XDG_CONFIG_HOME | |
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-${XDG_CONFIG_HOME:-$HOME/.config}/zsh}/.zprezto" | |
# Add $XDG_CONFIG_HOME and $ZDOTDIR to $HOME/.zshenv | |
# On a new install .zshenv should nto exists | |
if [ ! -f "$HOME/.zshenv" ] ; then touch "$HOME/.zshenv" ; fi | |
cat > "$HOME/.zshenv" << EOF | |
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:=$HOME/.config}" | |
[[ -d $XDG_CONFIG_HOME/zsh ]] && export ZDOTDIR="$XDG_CONFIG_HOME/zsh" | |
source "$ZDOTDIR/.zshenv" | |
EOF | |
# Create a new zsh configuration by copying/linking the Zsh configuration files provided | |
setopt EXTENDED_GLOB | |
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do | |
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}" | |
done | |
################################################################################ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment