summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-01-22 17:39:08 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-01-22 17:39:08 +0100
commited888229826268ef0e51802e4e8f1f8c66b4e69d (patch)
treec7d631f549b80970e950f54166bae1b52148a02b
parentc9904e97919dd5366b339a436466dfdfa3061bf5 (diff)
Add bootstrap sh script
-rwxr-xr-xbootstrap16
-rw-r--r--init.lua26
2 files changed, 24 insertions, 18 deletions
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 0000000..279b2a7
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+datadir="$HOME/.local/share/nvim"
+pluginsdir="$datadir/lazy"
+
+clone() {
+ user="$1"
+ plugin="$2"
+ plugindir="$pluginsdir/$plugin"
+ [ ! -d "$plugindir" ] && git clone --filter=blob:none --single-branch "https://github.com/$user/$plugin.git" "$plugindir"
+}
+
+[ ! -d "$datadir" ] && echo "Neovim does not seem to be installed!" && exit 1
+clone "folke" "lazy.nvim"
+clone "rktjmp" "hotpot.nvim"
+exit 0
diff --git a/init.lua b/init.lua
index edc5f6f..8816adb 100644
--- a/init.lua
+++ b/init.lua
@@ -1,23 +1,13 @@
-local function ensure(user, plugin)
- local path = vim.fn.stdpath "data" .. "/lazy/" .. plugin
- if not vim.loop.fs_stat(path) then
- vim.notify("Downloading " .. plugin .. "...", vim.log.levels.INFO)
- vim.fn.system {
- "git",
- "clone",
- "--filter=blob:none",
- "--single-branch",
- string.format("https://github.com/%s/%s.git", user, plugin),
- path,
- }
- end
- vim.opt.runtimepath:prepend(path)
-end
+local hotpot_path = vim.fn.stdpath "data" .. "/lazy/" .. "hotpot.nvim"
+vim.opt.runtimepath:prepend(hotpot_path)
-ensure("folke", "lazy.nvim")
-ensure("rktjmp", "hotpot.nvim")
+local ok, hotpot = pcall(require, "hotpot")
+if not ok then
+ vim.notify "You need to run the bootstrap!"
+ return
+end
-require("hotpot").setup {
+hotpot.setup {
provide_require_fennel = true,
compiler = {
modules = {