Olical / aniseed

Neovim configuration and plugins in Fennel (Lisp compiled to Lua)
https://discord.gg/wXAMr8F
The Unlicense
606 stars 28 forks source link

vimscript-less init #46

Closed Kethku closed 3 years ago

Kethku commented 3 years ago

I'm rewriting my vim config again, this time I'm trying to take a lua first approach for the package manager so that everything can be fennel.

I looked into it, and it appears that getting bootstrapped requires installing the aniseed plugin and the recommendation is to do that with a vimscript package manager. Is there any way to get around that by installing manually? I tried adding to the runtimepath and sourcing the plugin/aniseed.vim file, but I'm running into a strange error: image

Any ideas? I think a lua only approach would be pretty slick and would align with the new neovim 0.5 stuff quite well.

Kethku commented 3 years ago

Just as a follow on note, what I would LOVE would be to have a pure fennel init. I'm guessing such a thing would require a minimal bootstrap, but that would be my perfect world ideal :)

Kethku commented 3 years ago

So far the minimum I've got is an init.lua like this:

vim.o.shellslash = true
vim.g['aniseed#env'] = true

local execute = vim.api.nvim_command
local fn = vim.fn

local install_path = fn.stdpath('data')..'/site/pack/paqs/opt/paq-nvim'

if fn.empty(fn.glob(install_path)) > 0 then
  fn.system({'git', 'clone', 'https://github.com/savq/paq-nvim', install_path})
end

execute 'packadd paq-nvim'

local paq = require'paq-nvim'.paq
paq 'kethku/aniseed' -- Note: using my fork to fix the bug outlined in my other issue
paq 'savq/paq-nvim'

Although having something simpler would be ideal

Olical commented 3 years ago

So my init.lua in my dotfiles or in https://github.com/Olical/magic-kit may help a lot!

-- Welcome to your magic kit!
-- This is the first file Neovim will load.
-- We'll ensure we have a plugin manager and Aniseed.
-- This will allow us to load more Fennel based code and download more plugins.

-- Make some modules easier to access.
local execute = vim.api.nvim_command
local fn = vim.fn
local fmt = string.format

-- Work out where our plugins will be stored.
local pack_path = fn.stdpath("data") .. "/site/pack"

function ensure (user, repo)
  -- Ensures a given github.com/USER/REPO is cloned in the pack/packer/start directory.
  local install_path = fmt("%s/packer/start/%s", pack_path, repo, repo)
  if fn.empty(fn.glob(install_path)) > 0 then
    execute(fmt("!git clone https://github.com/%s/%s %s", user, repo, install_path))
    execute(fmt("packadd %s", repo))
  end
end

-- Packer is our plugin manager.
ensure("wbthomason", "packer.nvim")

-- Aniseed compiles our Fennel code to Lua and loads it automatically.
ensure("Olical", "aniseed")

-- Enable Aniseed's automatic compilation and loading of Fennel source code.
-- Aniseed looks for this when it's loaded then loads the rest of your
-- configuration if it's set.
vim.g["aniseed#env"] = {module = "magic.init"}

-- Now head to fnl/magic/init.fnl to continue your journey.
-- Try pressing gf on the file path to [g]o to the [f]ile.

So I upsert packer and aniseed into my native Neovim plugin loading system. You don't have to use packer of course.