<commit_before>#!/bin/bash
echo "# This will build your new home!"
echo ""

DIR="$( cd "$( dirname "$0" )" && pwd )"

##################################
#  check for installed packages  #
##################################

ask_install () {
    if [ `command -v apt-get` ]; then
        echo "-> Do you want me to install $1?"
        select yn in yes no
        do
            if [ -z $yn ]; then
                echo "invalid option"
            elif [ "$yn" == "yes" ]; then
                INSTALL="$INSTALL $1"
                break
            elif [ "$yn" == "no" ]; then
                break
            fi
        done
    fi
}

INSTALL=""
if [ ! `command -v git` ]; then
    GIT=false
    ask_install "git"
fi
if [ ! `command -v vim` ]; then
    VIM=false
    ask_install "vim"
fi
if [ ! `command -v tmux` ]; then
    TMUX=false
    ask_install "tmux"
fi
if [ ! `command -v zsh` ]; then
    ZSH_INSTALLED=false
    ask_install "zsh"
fi
if [ ! `command -v fish` ]; then
    FISH_INSTALLED=false
    ask_install "fish"
fi
if [ ! `command -v curl` ]; then
    CURL_INSTALLED=false
    ask_install "curl"
fi
if [ ! `command -v ctags` ]; then
    CTAGS=false
    ask_install "exuberant-ctags"
fi

if [ "$INSTALL" != "" ]; then
    echo "-> Installing ${INSTALL}"
    sudo apt-get install ${INSTALL}
fi

if [ `command -v git` ]; then
    GIT=true
fi
if [ `command -v vim` ]; then
    VIM=true
fi
if [ `command -v tmux` ]; then
    TMUX=true
fi
if [ `command -v zsh` ]; then
    ZSH_INSTALLED=true
fi
if [ `command -v fish` ]; then
    FISH_INSTALLED=true
fi
if [ `command -v curl` ]; then
    CURL_INSTALLED=true
fi

#######################
#  updating dotfiles  #
#######################
if [ "$GIT" = true ]; then
    echo "-> updating dotfiles"
    cd $DIR
    git pull
fi

echo "-> Install Home or Work environment?"
select myenv in home work
do
    if [ -z $myenv ]; then
        echo "invalid option"
    else
        echo "export ENVIRONMENT=$myenv" > ${HOME}/.sh_customvars
        break
    fi
done

echo "-> We are working on"
case "$(uname -s)" in
    Darwin)
        echo 'Mac OS X'
        CUROS="MACOS"
        ;;
    Linux)
        echo 'Linux'
        $DIR/bin/screenfetch_static > ${HOME}/.screenfetch
        echo "cat ${HOME}/.screenfetch" >> ${HOME}/.sh_customvars
        CUROS="LINUX"
        ;;
    CYGWIN*|MINGW32*|MSYS*)
        echo 'MS Windows'
        $DIR/bin/screenfetch_static > ${HOME}/.screenfetch
        echo "cat ${HOME}/.screenfetch" >> ${HOME}/.sh_customvars
        CUROS="WIN"
        ;;
    *)
        echo 'other OS'
        CUROS="OTHER"
        ;;
esac

#############################
#  backup and link .bashrc  #
#############################
BASHRC="${DIR}/.bashrc"
if [ -f ${HOME}/.bashrc ]; then
    if [ ! `readlink -f ${HOME}/.bashrc` = $BASHRC ]; then
        echo "-> move ${HOME}/.bashrc to ${HOME}/.bashrc_bak"
        mv ${HOME}/.bashrc ${HOME}/.bashrc_bak
        echo "-> link $BASHRC to ${HOME}/.bashrc"
        ln -s $BASHRC ${HOME}/.bashrc
    fi
else
    echo "-> link $BASHRC to ${HOME}/.bashrc"
    ln -s $BASHRC ${HOME}/.bashrc
fi

###########################
#  install omz zshrc  #
###########################
if [ "$ZSH_INSTALLED" = true ]; then
    if [ `command -v git` ]; then
        echo "-> installing OMZ"
        git clone git://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh --depth 1
        git clone https://github.com/bhilburn/powerlevel9k.git $HOME/.oh-my-zsh/custom/themes/powerlevel9k
    fi
    ZSHRC="${DIR}/.zshrc"
    if [ -f ${HOME}/.zshrc ]; then
        if [ ! `readlink -f ${HOME}/.zshrc` = $ZSHRC ]; then
            echo "-> move ${HOME}/.zshrc to ${HOME}/.zshrc_bak"
            mv ${HOME}/.zshrc ${HOME}/.zshrc_bak
            echo "-> link $ZSHRC to ${HOME}/.zshrc"
            ln -s $ZSHRC ${HOME}/.zshrc
        fi
    else
        echo "-> link $ZSHRC to ${HOME}/.zshrc"
        ln -s $ZSHRC ${HOME}/.zshrc
    fi
fi


#######################################
#  install fisherman and config.fish  #
#######################################
if [ "$FISH_INSTALLED" = true ]; then
    # install fisherman
    if [ "$CURL_INSTALLED" = true ]; then
	curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs https://git.io/fisher
	fish -c 'fisher z oh-my-fish/theme-bobthefish'<commit_msg>added zsh-autosuggestions<commit_after>#!/bin/bash
echo "# This will build your new home!"
echo ""

DIR="$( cd "$( dirname "$0" )" && pwd )"

##################################
#  check for installed packages  #
##################################

ask_install () {
    if [ `command -v apt-get` ]; then
        echo "-> Do you want me to install $1?"
        select yn in yes no
        do
            if [ -z $yn ]; then
                echo "invalid option"
            elif [ "$yn" == "yes" ]; then
                INSTALL="$INSTALL $1"
                break
            elif [ "$yn" == "no" ]; then
                break
            fi
        done
    fi
}

INSTALL=""
if [ ! `command -v git` ]; then
    GIT=false
    ask_install "git"
fi
if [ ! `command -v vim` ]; then
    VIM=false
    ask_install "vim"
fi
if [ ! `command -v tmux` ]; then
    TMUX=false
    ask_install "tmux"
fi
if [ ! `command -v zsh` ]; then
    ZSH_INSTALLED=false
    ask_install "zsh"
fi
if [ ! `command -v fish` ]; then
    FISH_INSTALLED=false
    ask_install "fish"
fi
if [ ! `command -v curl` ]; then
    CURL_INSTALLED=false
    ask_install "curl"
fi
if [ ! `command -v ctags` ]; then
    CTAGS=false
    ask_install "exuberant-ctags"
fi

if [ "$INSTALL" != "" ]; then
    echo "-> Installing ${INSTALL}"
    sudo apt-get install ${INSTALL}
fi

if [ `command -v git` ]; then
    GIT=true
fi
if [ `command -v vim` ]; then
    VIM=true
fi
if [ `command -v tmux` ]; then
    TMUX=true
fi
if [ `command -v zsh` ]; then
    ZSH_INSTALLED=true
fi
if [ `command -v fish` ]; then
    FISH_INSTALLED=true
fi
if [ `command -v curl` ]; then
    CURL_INSTALLED=true
fi

#######################
#  updating dotfiles  #
#######################
if [ "$GIT" = true ]; then
    echo "-> updating dotfiles"
    cd $DIR
    git pull
fi

echo "-> Install Home or Work environment?"
select myenv in home work
do
    if [ -z $myenv ]; then
        echo "invalid option"
    else
        echo "export ENVIRONMENT=$myenv" > ${HOME}/.sh_customvars
        break
    fi
done

echo "-> We are working on"
case "$(uname -s)" in
    Darwin)
        echo 'Mac OS X'
        CUROS="MACOS"
        ;;
    Linux)
        echo 'Linux'
        $DIR/bin/screenfetch_static > ${HOME}/.screenfetch
        echo "cat ${HOME}/.screenfetch" >> ${HOME}/.sh_customvars
        CUROS="LINUX"
        ;;
    CYGWIN*|MINGW32*|MSYS*)
        echo 'MS Windows'
        $DIR/bin/screenfetch_static > ${HOME}/.screenfetch
        echo "cat ${HOME}/.screenfetch" >> ${HOME}/.sh_customvars
        CUROS="WIN"
        ;;
    *)
        echo 'other OS'
        CUROS="OTHER"
        ;;
esac

#############################
#  backup and link .bashrc  #
#############################
BASHRC="${DIR}/.bashrc"
if [ -f ${HOME}/.bashrc ]; then
    if [ ! `readlink -f ${HOME}/.bashrc` = $BASHRC ]; then
        echo "-> move ${HOME}/.bashrc to ${HOME}/.bashrc_bak"
        mv ${HOME}/.bashrc ${HOME}/.bashrc_bak
        echo "-> link $BASHRC to ${HOME}/.bashrc"
        ln -s $BASHRC ${HOME}/.bashrc
    fi
else
    echo "-> link $BASHRC to ${HOME}/.bashrc"
    ln -s $BASHRC ${HOME}/.bashrc
fi

###########################
#  install omz zshrc  #
###########################
if [ "$ZSH_INSTALLED" = true ]; then
    if [ `command -v git` ]; then
        echo "-> installing OMZ"
        git clone https://github.com/robbyrussell/oh-my-zsh.git ${HOME}/.oh-my-zsh --depth 1
        git clone https://github.com/bhilburn/powerlevel9k.git ${HOME}/.oh-my-zsh/custom/themes/powerlevel9k
	git clone https://github.com/zsh-users/zsh-autosuggestions.git ${HOME}/.oh-my-zsh/custom/plugins/zsh-autosuggestions
    fi
    ZSHRC="${DIR}/.zshrc"
    if [ -f ${HOME}/.zshrc ]; then
        if [ ! `readlink -f ${HOME}/.zshrc` = $ZSHRC ]; then
            echo "-> move ${HOME}/.zshrc to ${HOME}/.zshrc_bak"
            mv ${HOME}/.zshrc ${HOME}/.zshrc_bak
            echo "-> link $ZSHRC to ${HOME}/.zshrc"
            ln -s $ZSHRC ${HOME}/.zshrc
        fi
    else
        echo "-> link $ZSHRC to ${HOME}/.zshrc"
        ln -s $ZSHRC ${HOME}/.zshrc
    fi
fi


#######################################
#  install fisherman and config.fish  #
#######################################
if [ "$FISH_INSTALLED" = true ]; then
    # install fisherman
    if [ "$CURL_INSTALLED" = true ]; then
	curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs https://git.io/fisher
	fish -c 'fisher z oh-my-fish/theme-bobthefish'
{'fraction_non_alphanumeric': 0.2143184421534937, 'fraction_numerical': 0.0018327605956471936, 'mean_word_length': 2.292232277526395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 41, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3888486', 'n_tokens_mistral': 3156, 'n_tokens_neox': 3007, 'n_words': 792}