2021-08-23 17:18:42 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eo pipefail
|
2021-03-15 03:25:28 +01:00
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
#Set branch to master unless specified by the user
|
2021-10-16 13:07:55 +02:00
|
|
|
declare LV_BRANCH="${LV_BRANCH:-"master"}"
|
2021-08-23 17:18:42 +02:00
|
|
|
declare -r LV_REMOTE="${LV_REMOTE:-lunarvim/lunarvim.git}"
|
|
|
|
declare -r INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}"
|
2021-03-15 03:25:28 +01:00
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
declare -r XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}"
|
|
|
|
declare -r XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}"
|
|
|
|
declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}"
|
2021-08-02 18:04:26 +02:00
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}"
|
|
|
|
declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}"
|
2021-12-11 19:52:34 +01:00
|
|
|
declare -r LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}"
|
|
|
|
|
2021-09-13 11:10:07 +02:00
|
|
|
# TODO: Use a dedicated cache directory #1256
|
|
|
|
declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim"
|
2021-03-15 03:25:28 +01:00
|
|
|
|
2021-09-30 18:53:14 +02:00
|
|
|
declare BASEDIR
|
|
|
|
BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
|
|
|
BASEDIR="$(dirname -- "$(dirname -- "$BASEDIR")")"
|
|
|
|
readonly BASEDIR
|
|
|
|
|
|
|
|
declare ARGS_LOCAL=0
|
|
|
|
declare ARGS_OVERWRITE=0
|
|
|
|
declare ARGS_INSTALL_DEPENDENCIES=1
|
2022-03-02 15:57:14 +01:00
|
|
|
declare INTERACTIVE_MODE=1
|
2021-09-30 18:53:14 +02:00
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
declare -a __lvim_dirs=(
|
|
|
|
"$LUNARVIM_CONFIG_DIR"
|
|
|
|
"$LUNARVIM_RUNTIME_DIR"
|
2021-09-13 11:10:07 +02:00
|
|
|
"$LUNARVIM_CACHE_DIR"
|
2021-08-23 17:18:42 +02:00
|
|
|
)
|
2021-04-16 03:24:01 +02:00
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
declare -a __npm_deps=(
|
|
|
|
"neovim"
|
|
|
|
"tree-sitter-cli"
|
|
|
|
)
|
2021-06-18 23:43:30 +02:00
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
declare -a __pip_deps=(
|
|
|
|
"pynvim"
|
|
|
|
)
|
2021-03-15 03:25:28 +01:00
|
|
|
|
2021-09-21 08:52:46 +02:00
|
|
|
function usage() {
|
|
|
|
echo "Usage: install.sh [<options>]"
|
|
|
|
echo ""
|
|
|
|
echo "Options:"
|
2022-03-02 15:57:14 +01:00
|
|
|
echo " -h, --help Print this help message"
|
|
|
|
echo " -l, --local Install local copy of LunarVim"
|
|
|
|
echo " -y, --yes Disable confirmation prompts (answer yes to all questions)"
|
|
|
|
echo " --overwrite Overwrite previous LunarVim configuration (a backup is always performed first)"
|
|
|
|
echo " --[no]-install-dependencies Whether to automatically install external dependencies (will prompt by default)"
|
2021-09-21 08:52:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function parse_arguments() {
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
|
|
case "$1" in
|
2021-09-30 18:53:14 +02:00
|
|
|
-l | --local)
|
|
|
|
ARGS_LOCAL=1
|
2021-09-21 08:52:46 +02:00
|
|
|
;;
|
|
|
|
--overwrite)
|
2021-09-30 18:53:14 +02:00
|
|
|
ARGS_OVERWRITE=1
|
|
|
|
;;
|
2022-03-02 15:57:14 +01:00
|
|
|
-y | --yes)
|
|
|
|
INTERACTIVE_MODE=0
|
|
|
|
;;
|
2021-09-30 18:53:14 +02:00
|
|
|
--install-dependencies)
|
|
|
|
ARGS_INSTALL_DEPENDENCIES=1
|
|
|
|
;;
|
|
|
|
--no-install-dependencies)
|
|
|
|
ARGS_INSTALL_DEPENDENCIES=0
|
2021-09-21 08:52:46 +02:00
|
|
|
;;
|
|
|
|
-h | --help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2021-10-01 13:27:06 +02:00
|
|
|
function msg() {
|
|
|
|
local text="$1"
|
|
|
|
local div_width="80"
|
|
|
|
printf "%${div_width}s\n" ' ' | tr ' ' -
|
|
|
|
printf "%s\n" "$text"
|
|
|
|
}
|
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
function main() {
|
2021-09-21 08:52:46 +02:00
|
|
|
parse_arguments "$@"
|
|
|
|
|
2021-10-01 13:27:06 +02:00
|
|
|
print_logo
|
2021-03-15 03:25:28 +01:00
|
|
|
|
2021-10-01 13:27:06 +02:00
|
|
|
msg "Detecting platform for managing any additional neovim dependencies"
|
2021-08-23 17:18:42 +02:00
|
|
|
detect_platform
|
2021-04-16 03:24:01 +02:00
|
|
|
|
2021-08-26 20:32:16 +02:00
|
|
|
check_system_deps
|
2021-08-23 17:18:42 +02:00
|
|
|
|
2021-09-30 18:53:14 +02:00
|
|
|
if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then
|
2022-03-02 15:57:14 +01:00
|
|
|
if [ "$INTERACTIVE_MODE" -eq 1 ]; then
|
|
|
|
msg "Would you like to install LunarVim's NodeJS dependencies?"
|
|
|
|
read -p "[y]es or [n]o (default: no) : " -r answer
|
|
|
|
[ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps
|
|
|
|
|
|
|
|
msg "Would you like to install LunarVim's Python dependencies?"
|
|
|
|
read -p "[y]es or [n]o (default: no) : " -r answer
|
|
|
|
[ "$answer" != "${answer#[Yy]}" ] && install_python_deps
|
|
|
|
|
|
|
|
msg "Would you like to install LunarVim's Rust dependencies?"
|
|
|
|
read -p "[y]es or [n]o (default: no) : " -r answer
|
|
|
|
[ "$answer" != "${answer#[Yy]}" ] && install_rust_deps
|
|
|
|
else
|
|
|
|
install_nodejs_deps
|
|
|
|
install_python_deps
|
|
|
|
install_rust_deps
|
|
|
|
fi
|
2021-09-21 08:52:46 +02:00
|
|
|
fi
|
2021-08-23 17:18:42 +02:00
|
|
|
|
2021-08-26 20:32:16 +02:00
|
|
|
backup_old_config
|
2021-08-23 17:18:42 +02:00
|
|
|
|
2021-12-09 11:51:37 +01:00
|
|
|
verify_lvim_dirs
|
2021-08-23 17:18:42 +02:00
|
|
|
|
2021-12-11 19:52:34 +01:00
|
|
|
if [ "$ARGS_LOCAL" -eq 1 ]; then
|
|
|
|
link_local_lvim
|
2021-12-11 20:08:25 +01:00
|
|
|
elif [ -d "$LUNARVIM_BASE_DIR" ]; then
|
2021-12-11 19:52:34 +01:00
|
|
|
validate_lunarvim_files
|
2021-08-23 17:18:42 +02:00
|
|
|
else
|
2021-12-11 19:52:34 +01:00
|
|
|
clone_lvim
|
2021-08-12 11:31:31 +02:00
|
|
|
fi
|
|
|
|
|
2021-12-11 19:52:34 +01:00
|
|
|
setup_lvim
|
|
|
|
|
2021-10-01 13:27:06 +02:00
|
|
|
msg "Thank you for installing LunarVim!!"
|
|
|
|
echo "You can start it by running: $INSTALL_PREFIX/bin/lvim"
|
|
|
|
echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
|
2021-08-23 17:18:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function detect_platform() {
|
|
|
|
OS="$(uname -s)"
|
|
|
|
case "$OS" in
|
|
|
|
Linux)
|
|
|
|
if [ -f "/etc/arch-release" ] || [ -f "/etc/artix-release" ]; then
|
|
|
|
RECOMMEND_INSTALL="sudo pacman -S"
|
|
|
|
elif [ -f "/etc/fedora-release" ] || [ -f "/etc/redhat-release" ]; then
|
|
|
|
RECOMMEND_INSTALL="sudo dnf install -y"
|
|
|
|
elif [ -f "/etc/gentoo-release" ]; then
|
|
|
|
RECOMMEND_INSTALL="emerge install -y"
|
|
|
|
else # assume debian based
|
|
|
|
RECOMMEND_INSTALL="sudo apt install -y"
|
|
|
|
fi
|
|
|
|
;;
|
2021-10-20 17:44:37 +02:00
|
|
|
FreeBSD)
|
|
|
|
RECOMMEND_INSTALL="sudo pkg install -y"
|
|
|
|
;;
|
|
|
|
NetBSD)
|
|
|
|
RECOMMEND_INSTALL="sudo pkgin install"
|
|
|
|
;;
|
|
|
|
OpenBSD)
|
|
|
|
RECOMMEND_INSTALL="doas pkg_add"
|
|
|
|
;;
|
2021-08-23 17:18:42 +02:00
|
|
|
Darwin)
|
|
|
|
RECOMMEND_INSTALL="brew install"
|
2021-08-12 11:31:31 +02:00
|
|
|
;;
|
|
|
|
*)
|
2021-08-23 17:18:42 +02:00
|
|
|
echo "OS $OS is not currently supported."
|
|
|
|
exit 1
|
2021-08-12 11:31:31 +02:00
|
|
|
;;
|
|
|
|
esac
|
2021-08-23 17:18:42 +02:00
|
|
|
}
|
2021-08-12 11:31:31 +02:00
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
function print_missing_dep_msg() {
|
2021-09-21 08:52:46 +02:00
|
|
|
if [ "$#" -eq 1 ]; then
|
|
|
|
echo "[ERROR]: Unable to find dependency [$1]"
|
|
|
|
echo "Please install it first and re-run the installer. Try: $RECOMMEND_INSTALL $1"
|
|
|
|
else
|
|
|
|
local cmds
|
|
|
|
cmds=$(for i in "$@"; do echo "$RECOMMEND_INSTALL $i"; done)
|
|
|
|
printf "[ERROR]: Unable to find dependencies [%s]" "$@"
|
|
|
|
printf "Please install any one of the dependencies and re-run the installer. Try: \n%s\n" "$cmds"
|
2021-08-12 11:31:31 +02:00
|
|
|
fi
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-12-06 17:04:46 +01:00
|
|
|
function check_neovim_min_version() {
|
2022-01-24 13:01:57 +01:00
|
|
|
local verify_version_cmd='if !has("nvim-0.6.1") | cquit | else | quit | endif'
|
2021-12-06 17:04:46 +01:00
|
|
|
|
|
|
|
# exit with an error if min_version not found
|
|
|
|
if ! nvim --headless -u NONE -c "$verify_version_cmd"; then
|
2022-01-24 13:01:57 +01:00
|
|
|
echo "[ERROR]: LunarVim requires at least Neovim v0.6.1 or higher"
|
2021-12-06 17:04:46 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-12-11 19:52:34 +01:00
|
|
|
function validate_lunarvim_files() {
|
|
|
|
local verify_version_cmd='if v:errmsg != "" | cquit | else | quit | endif'
|
|
|
|
if ! "$INSTALL_PREFIX/bin/lvim" --headless -c 'LvimUpdate' -c "$verify_version_cmd" &>/dev/null; then
|
|
|
|
msg "Removing old installation files"
|
|
|
|
rm -rf "$LUNARVIM_BASE_DIR"
|
|
|
|
clone_lvim
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
function check_system_deps() {
|
|
|
|
if ! command -v git &>/dev/null; then
|
|
|
|
print_missing_dep_msg "git"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if ! command -v nvim &>/dev/null; then
|
|
|
|
print_missing_dep_msg "neovim"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-12-06 17:04:46 +01:00
|
|
|
check_neovim_min_version
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2022-02-14 17:01:21 +01:00
|
|
|
function __install_nodejs_deps_pnpm() {
|
|
|
|
echo "Installing node modules with pnpm.."
|
|
|
|
pnpm install -g "${__npm_deps[@]}"
|
|
|
|
echo "All NodeJS dependencies are successfully installed"
|
|
|
|
}
|
|
|
|
|
2021-09-21 08:52:46 +02:00
|
|
|
function __install_nodejs_deps_npm() {
|
2021-08-23 17:18:42 +02:00
|
|
|
echo "Installing node modules with npm.."
|
|
|
|
for dep in "${__npm_deps[@]}"; do
|
|
|
|
if ! npm ls -g "$dep" &>/dev/null; then
|
|
|
|
printf "installing %s .." "$dep"
|
|
|
|
npm install -g "$dep"
|
|
|
|
fi
|
|
|
|
done
|
2021-12-20 09:00:04 +01:00
|
|
|
|
2021-10-02 18:02:55 +02:00
|
|
|
echo "All NodeJS dependencies are successfully installed"
|
2021-08-04 05:12:05 +02:00
|
|
|
}
|
|
|
|
|
2021-09-21 08:52:46 +02:00
|
|
|
function __install_nodejs_deps_yarn() {
|
|
|
|
echo "Installing node modules with yarn.."
|
|
|
|
yarn global add "${__npm_deps[@]}"
|
2021-10-02 18:02:55 +02:00
|
|
|
echo "All NodeJS dependencies are successfully installed"
|
2021-09-21 08:52:46 +02:00
|
|
|
}
|
|
|
|
|
2021-12-20 09:00:04 +01:00
|
|
|
function __validate_node_installation() {
|
|
|
|
local pkg_manager="$1"
|
|
|
|
local manager_home
|
2021-12-26 12:56:31 +01:00
|
|
|
|
|
|
|
if ! command -v "$pkg_manager" &>/dev/null; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$pkg_manager" == "npm" ]; then
|
|
|
|
manager_home="$(npm config get prefix 2>/dev/null)"
|
2022-02-14 17:01:21 +01:00
|
|
|
elif [ "$pkg_manager" == "pnpm" ]; then
|
|
|
|
manager_home="$(pnpm config get prefix 2>/dev/null)"
|
2021-12-26 12:56:31 +01:00
|
|
|
else
|
|
|
|
manager_home="$(yarn global bin 2>/dev/null)"
|
|
|
|
fi
|
2021-12-20 09:00:04 +01:00
|
|
|
|
|
|
|
if [ ! -d "$manager_home" ] || [ ! -w "$manager_home" ]; then
|
2021-12-26 12:56:31 +01:00
|
|
|
echo "[ERROR] Unable to install using [$pkg_manager] without administrative privileges."
|
|
|
|
return 1
|
2021-12-20 09:00:04 +01:00
|
|
|
fi
|
2021-12-26 12:56:31 +01:00
|
|
|
|
|
|
|
return 0
|
2021-12-20 09:00:04 +01:00
|
|
|
}
|
|
|
|
|
2021-09-21 08:52:46 +02:00
|
|
|
function install_nodejs_deps() {
|
2022-02-14 17:01:21 +01:00
|
|
|
local -a pkg_managers=("pnpm" "yarn" "npm")
|
2021-09-21 08:52:46 +02:00
|
|
|
for pkg_manager in "${pkg_managers[@]}"; do
|
2021-12-26 12:56:31 +01:00
|
|
|
if __validate_node_installation "$pkg_manager"; then
|
2021-09-21 08:52:46 +02:00
|
|
|
eval "__install_nodejs_deps_$pkg_manager"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
print_missing_dep_msg "${pkg_managers[@]}"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
function install_python_deps() {
|
|
|
|
echo "Verifying that pip is available.."
|
|
|
|
if ! python3 -m ensurepip &>/dev/null; then
|
2021-08-26 12:53:29 +02:00
|
|
|
if ! python3 -m pip --version &>/dev/null; then
|
2021-08-26 12:08:48 +02:00
|
|
|
print_missing_dep_msg "pip"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-08-23 17:18:42 +02:00
|
|
|
fi
|
|
|
|
echo "Installing with pip.."
|
|
|
|
for dep in "${__pip_deps[@]}"; do
|
2021-08-26 12:53:29 +02:00
|
|
|
python3 -m pip install --user "$dep"
|
2021-08-23 17:18:42 +02:00
|
|
|
done
|
2021-10-02 18:02:55 +02:00
|
|
|
echo "All Python dependencies are successfully installed"
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
function __attempt_to_install_with_cargo() {
|
2021-09-21 08:52:46 +02:00
|
|
|
if command -v cargo &>/dev/null; then
|
2021-08-23 17:18:42 +02:00
|
|
|
echo "Installing missing Rust dependency with cargo"
|
|
|
|
cargo install "$1"
|
|
|
|
else
|
2021-09-21 08:52:46 +02:00
|
|
|
echo "[WARN]: Unable to find cargo. Make sure to install it to avoid any problems"
|
|
|
|
exit 1
|
2021-08-23 17:18:42 +02:00
|
|
|
fi
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
# we try to install the missing one with cargo even though it's unlikely to be found
|
|
|
|
function install_rust_deps() {
|
2021-09-21 08:52:46 +02:00
|
|
|
local -a deps=("fd::fd-find" "rg::ripgrep")
|
|
|
|
for dep in "${deps[@]}"; do
|
|
|
|
if ! command -v "${dep%%::*}" &>/dev/null; then
|
|
|
|
__attempt_to_install_with_cargo "${dep##*::}"
|
|
|
|
fi
|
|
|
|
done
|
2021-10-02 18:02:55 +02:00
|
|
|
echo "All Rust dependencies are successfully installed"
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-12-09 11:51:37 +01:00
|
|
|
function verify_lvim_dirs() {
|
|
|
|
if [ "$ARGS_OVERWRITE" -eq 1 ]; then
|
|
|
|
for dir in "${__lvim_dirs[@]}"; do
|
|
|
|
[ -d "$dir" ] && rm -rf "$dir"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
for dir in "${__lvim_dirs[@]}"; do
|
|
|
|
mkdir -p "$dir"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
function backup_old_config() {
|
2022-03-10 09:54:38 +01:00
|
|
|
local src="$LUNARVIM_CONFIG_DIR"
|
2022-03-18 10:20:54 +01:00
|
|
|
if [ ! -d "$src" ]; then
|
2022-03-10 09:54:38 +01:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
mkdir -p "$src.old"
|
|
|
|
touch "$src/ignore"
|
|
|
|
msg "Backing up old $src to $src.old"
|
|
|
|
if command -v rsync &>/dev/null; then
|
|
|
|
rsync --archive -hh --stats --partial --copy-links --cvs-exclude "$src"/ "$src.old"
|
|
|
|
else
|
|
|
|
OS="$(uname -s)"
|
|
|
|
case "$OS" in
|
|
|
|
Linux | *BSD)
|
|
|
|
cp -r "$src/"* "$src.old/."
|
|
|
|
;;
|
|
|
|
Darwin)
|
|
|
|
cp -R "$src/"* "$src.old/."
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "OS $OS is not currently supported."
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2021-12-11 20:08:25 +01:00
|
|
|
msg "Backup operation complete"
|
2021-08-02 18:04:26 +02:00
|
|
|
}
|
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
function clone_lvim() {
|
2021-10-01 13:27:06 +02:00
|
|
|
msg "Cloning LunarVim configuration"
|
2021-08-26 20:32:16 +02:00
|
|
|
if ! git clone --branch "$LV_BRANCH" \
|
2021-12-11 19:52:34 +01:00
|
|
|
--depth 1 "https://github.com/${LV_REMOTE}" "$LUNARVIM_BASE_DIR"; then
|
2021-08-23 17:18:42 +02:00
|
|
|
echo "Failed to clone repository. Installation failed."
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-04-16 03:24:01 +02:00
|
|
|
}
|
|
|
|
|
2021-09-30 18:53:14 +02:00
|
|
|
function link_local_lvim() {
|
|
|
|
echo "Linking local LunarVim repo"
|
|
|
|
|
|
|
|
# Detect whether it's a symlink or a folder
|
2021-12-11 19:52:34 +01:00
|
|
|
if [ -d "$LUNARVIM_BASE_DIR" ]; then
|
2021-09-30 18:53:14 +02:00
|
|
|
echo "Removing old installation files"
|
2021-12-11 19:52:34 +01:00
|
|
|
rm -rf "$LUNARVIM_BASE_DIR"
|
2021-09-30 18:53:14 +02:00
|
|
|
fi
|
|
|
|
|
2021-12-11 19:52:34 +01:00
|
|
|
echo " - $BASEDIR -> $LUNARVIM_BASE_DIR"
|
|
|
|
ln -s -f "$BASEDIR" "$LUNARVIM_BASE_DIR"
|
2021-09-30 18:53:14 +02:00
|
|
|
}
|
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
function setup_shim() {
|
2022-01-03 15:47:58 +01:00
|
|
|
make -C "$LUNARVIM_BASE_DIR" install-bin
|
2021-06-18 23:43:30 +02:00
|
|
|
}
|
|
|
|
|
2021-09-21 11:56:24 +02:00
|
|
|
function remove_old_cache_files() {
|
|
|
|
local packer_cache="$LUNARVIM_CONFIG_DIR/plugin/packer_compiled.lua"
|
|
|
|
if [ -e "$packer_cache" ]; then
|
2021-10-01 13:27:06 +02:00
|
|
|
msg "Removing old packer cache file"
|
2021-09-21 11:56:24 +02:00
|
|
|
rm -f "$packer_cache"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e "$LUNARVIM_CACHE_DIR/luacache" ] || [ -e "$LUNARVIM_CACHE_DIR/lvim_cache" ]; then
|
2021-10-01 13:27:06 +02:00
|
|
|
msg "Removing old startup cache file"
|
2021-09-21 11:56:24 +02:00
|
|
|
rm -f "$LUNARVIM_CACHE_DIR/{luacache,lvim_cache}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
function setup_lvim() {
|
2021-09-21 11:56:24 +02:00
|
|
|
|
|
|
|
remove_old_cache_files
|
|
|
|
|
2021-10-01 13:27:06 +02:00
|
|
|
msg "Installing LunarVim shim"
|
2021-08-23 17:18:42 +02:00
|
|
|
|
|
|
|
setup_shim
|
|
|
|
|
2021-12-11 19:52:34 +01:00
|
|
|
cp "$LUNARVIM_BASE_DIR/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua"
|
2021-08-23 17:18:42 +02:00
|
|
|
|
2021-11-27 15:22:43 +01:00
|
|
|
echo "Preparing Packer setup"
|
|
|
|
|
2021-09-13 11:10:07 +02:00
|
|
|
"$INSTALL_PREFIX/bin/lvim" --headless \
|
2021-08-26 20:32:16 +02:00
|
|
|
-c 'autocmd User PackerComplete quitall' \
|
|
|
|
-c 'PackerSync'
|
2021-08-23 17:18:42 +02:00
|
|
|
|
|
|
|
echo "Packer setup complete"
|
2021-03-15 03:25:28 +01:00
|
|
|
}
|
|
|
|
|
2021-10-01 13:27:06 +02:00
|
|
|
function print_logo() {
|
|
|
|
cat <<'EOF'
|
|
|
|
|
|
|
|
88\ 88\
|
|
|
|
88 | \__|
|
|
|
|
88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\
|
|
|
|
88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\
|
|
|
|
88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 |
|
|
|
|
88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 |
|
|
|
|
88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 |
|
|
|
|
\__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__|
|
|
|
|
|
|
|
|
EOF
|
2021-08-23 17:18:42 +02:00
|
|
|
}
|
2021-07-27 00:26:37 +02:00
|
|
|
|
2021-08-23 17:18:42 +02:00
|
|
|
main "$@"
|