From 9e60593a843a671fd3daa5e083555bc40c063b2a Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 10 Jul 2023 10:45:46 -0700 Subject: [PATCH] Fix the diff and add a line to rename existing files --- setup.sh | 10 +++++++--- zsh/prezto.diff | 12 ++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/setup.sh b/setup.sh index 6261c77..01a9be3 100644 --- a/setup.sh +++ b/setup.sh @@ -30,6 +30,7 @@ function install_build_tools() { function setup_neovim() { # Set up Neovim if [[ -d "$HOME/.config/nvim" ]]; then + echo "Neovim already installed, skipping setup" return fi echo "Setting up neovim..." @@ -44,6 +45,10 @@ function setup_neovim() { function setup_git() { # Set up Git + if [[ -f "$HOME/.gitconfig" ]]; then + echo "Git already installed, skipping" + return + fi echo "Setting up git..." check_or_install git git git config --global alias.co checkout @@ -64,14 +69,13 @@ function setup_git() { function setup_zsh() { # Set up ZSH if [[ -d "$HOME/.zprezto" ]]; then + echo "Prezto already installed, skipping" return fi echo "Setting up zsh..." check_or_install zsh zsh git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" - if [[ -f "$HOME/.zshrc" ]]; then - mv "$HOME/.zshrc" "$HOME/.zshrc.original" - fi + zsh -c 'setopt EXTENDED_GLOB; for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do if [[ -f "${ZDOTDIR:-$HOME}/.${rcfile:t}" ]]; then mv "${ZDOTDIR:-$HOME}/.${rcfile:t}" "${ZDOTDIR:-$HOME}/.${rcfile:t}.orig"; fi; done' zsh -c 'setopt EXTENDED_GLOB; for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"; done' cd $HOME patch -p0 < $DIR/zsh/prezto.diff diff --git a/zsh/prezto.diff b/zsh/prezto.diff index 0c35c46..d4b9993 100644 --- a/zsh/prezto.diff +++ b/zsh/prezto.diff @@ -1,7 +1,7 @@ -diff --git zpreztorc zpreztorc +diff --git .zprezto/runcoms/zpreztorc .zprezto/runcoms/zpreztorc index ae68a89..2c1e405 100644 ---- zpreztorc -+++ zpreztorc +--- .zprezto/runcoms/zpreztorc ++++ .zprezto/runcoms/zpreztorc @@ -38,8 +38,11 @@ zstyle ':prezto:load' pmodule \ 'spectrum' \ 'utility' \ @@ -83,10 +83,10 @@ index ae68a89..2c1e405 100644 # # Tmux -diff --git zshrc zshrc +diff --git .zprezto/runcoms/zshrc .zprezto/runcoms/zshrc index 039b882..58f1b30 100644 ---- zshrc -+++ zshrc +--- .zprezto/runcoms/zshrc ++++ .zprezto/runcoms/zshrc @@ -10,4 +10,11 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" fi