#!/usr/bin/env bash

#-----------------------------------
# Name:     neovim
# Version:  1.0.0
# Author:   Solomon Laing
# Description:
# Installs neovim on the system.
#-----------------------------------

if command -v neovim &>/dev/null; then
    echo "neovim is already installed on the system."
    exit 0
fi

echo "This script is going to attempt install neovim. As such it will ask for root privilages."

git clone --depth 1 https://github.com/neovim/neovim "$HOME/repos/github.com/neovim/neovim"
sudo pacman -S base-devel cmake ninja curl || exit 1

cd "$HOME/repos/github.com/neovim/neovim" || exit 1
make CMAKE_BUILD_TYPE=Release || exit 1
sudo make install || exit 1
exit 0
