feat(nvim): initialize fennel
This commit is contained in:
parent
e21b930344
commit
60fa4c7121
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
config/nvim/lua
|
||||||
|
|
19
config/nvim/.hotpot.lua
Normal file
19
config/nvim/.hotpot.lua
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
-- By default, the Fennel compiler wont complain if unknown variables are
|
||||||
|
-- referenced, we can force a compiler error so we don't try to run faulty code.
|
||||||
|
local allowed_globals = {}
|
||||||
|
for key, _ in pairs(_G) do
|
||||||
|
table.insert(allowed_globals, key)
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- by default, build all fnl/ files into lua/
|
||||||
|
build = true,
|
||||||
|
-- remove stale lua/ files
|
||||||
|
clean = true,
|
||||||
|
compiler = {
|
||||||
|
modules = {
|
||||||
|
-- enforce unknown variable errors
|
||||||
|
allowedGlobals = allowed_globals,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
3
config/nvim/fnl/plugins/init.fnl
Normal file
3
config/nvim/fnl/plugins/init.fnl
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
(print ":D (happy) (fennel lazy module)")
|
||||||
|
|
||||||
|
[]
|
48
config/nvim/init.lua
Normal file
48
config/nvim/init.lua
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
-- Ensure lazy and hotpot are always installed
|
||||||
|
local function ensure_installed(plugin, branch)
|
||||||
|
local user, repo = string.match(plugin, "(.+)/(.+)")
|
||||||
|
local repo_path = vim.fn.stdpath("data") .. "/lazy/" .. repo
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(repo_path) then
|
||||||
|
vim.notify("Installing " .. plugin .. " " .. branch)
|
||||||
|
local repo_url = "https://github.com/" .. plugin .. ".git"
|
||||||
|
local out = vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"--branch=" .. branch,
|
||||||
|
repo_url,
|
||||||
|
repo_path,
|
||||||
|
})
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone " .. plugin .. ":\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return repo_path
|
||||||
|
end
|
||||||
|
local lazy_path = ensure_installed("folke/lazy.nvim", "stable")
|
||||||
|
local hotpot_path = ensure_installed("rktjmp/hotpot.nvim", "v0.14.6")
|
||||||
|
-- As per Lazy's install instructions, but also include hotpot
|
||||||
|
vim.opt.runtimepath:prepend({ hotpot_path, lazy_path })
|
||||||
|
|
||||||
|
-- You must call vim.loader.enable() before requiring hotpot unless you are
|
||||||
|
-- passing {performance = {cache = false}} to Lazy.
|
||||||
|
vim.loader.enable()
|
||||||
|
|
||||||
|
require("hotpot") -- Optionally you may call require("hotpot").setup(...) here
|
||||||
|
|
||||||
|
-- You must include Hotpot in your plugin list for it to function correctly.
|
||||||
|
-- If you want to use Lazy's "structured" style, see the next code sample.
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
-- Add hotpot directly here
|
||||||
|
{ "rktjmp/hotpot.nvim" },
|
||||||
|
-- Then import your other plugins
|
||||||
|
{ import = "plugins" },
|
||||||
|
},
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user