-- vi: et sw=4 ts=4: -- hsv2 ---@param branch string local function clone(branch) local path = vim.fn.stdpath("data") .. "/site/pack/hsv2/opt/hsv2.nvim" if vim.fn.empty(vim.fn.glob(path)) > 0 then local output = vim.fn.system { "git", "clone", "--branch", branch, "--depth=1", "https://git.disroot.org/soratobuneko/hsv2-neovim", path } return vim.v.shell_error == 0, output end return true end ---@param branch string ---|> "master" ---| "dev" function INSTALL_HSV2(branch) local valid = { master = true, dev = true } branch = valid[branch] and branch or "master" local status, output = clone(branch) if not status then vim.api.nvim_echo({ { "Failed to clone repository", "Error" }, { output, "Error" }, }, true, {}) return end vim.api.nvim_echo({ { "Loading hsv2.nvim…" } }, true, {}) vim.api.nvim_exec("packadd hsv2.nvim", false) local status, hsv2 = pcall(require, "hsv2") if status then vim.api.nvim_echo({ { "Loaded!" } }, true, {}) return vim.pretty_print(require("hsv2")) else vim.api.nvim_echo({ { "Failed!\n", "Error" }, { hsv2, "Error" } }, true, {}) end end