Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve macro.fnl file support #62

Closed
Olical opened this issue Aug 25, 2021 · 7 comments
Closed

Improve macro.fnl file support #62

Olical opened this issue Aug 25, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@Olical
Copy link
Owner

Olical commented Aug 25, 2021

Right now I think files called macros.fnl are the only ones copied over to the lua dir on compilation which ensures they end up on the path. That path is used when requiring the macros, so if your macro file isn't named appropriately it either won't be copied into the right place or Ansieed will try to compile it which will error since macro files can't be compiled.

There's no way to tell that something contains macros without prior knowledge, so we still have to make assumptions. I think the best bet is defaulting to finding anything ending in macros.fnl and making it easily reconfigurable. Then maybe don't copy them, but just add them to an exclude pattern then add the fnl dir to the macros path. (which is new in the latest fennel version!)

@Olical Olical added the enhancement New feature or request label Aug 25, 2021
@datwaft
Copy link

datwaft commented Sep 6, 2021

I was just having this issue while trying to separate my macros into multiple files.

I was trying to do something like:

.
├── fnl
│   └── core
│       ├── init.fnl
│       └── macros
│           ├── core-macros.fnl
│           ├── pack-macros.fnl
│           └── vim-macros.fnl
└── init.lua

@Olical
Copy link
Owner Author

Olical commented Sep 6, 2021

Out of interest, does it work fine on the develop branch? I couldn't actually spot any issues but I've done some work around this area and written some more tests so I may have caught it now 🤔

I've made a LOT of changes on develop so the module macros compile to much more efficient / minimal Lua and there's a few issues around interactive evaluation that I'm still working out #63

So bearing in mind there's other issues I'm fixing, it might still be worth checking if the macro file problem is fixed. I've tried this myself on developand fnl/dotfiles/plugin/some-macros.fnl worked fine for me 🤔 although I think I did have to restart nvim for it to work.

@datwaft
Copy link

datwaft commented Sep 7, 2021

Doesn't seem to work.
It gives this error:

E5108: Error executing lua ...m/site/pack/packer/start/aniseed/lua/aniseed/compile.lua:73: Could not open file: /home/datwaft/.config/nvim.main/lua/core/macros/core-macros.fnl: No such file or directory

Here is the tree view:

fnl/core
├── autocmd.fnl
├── globals.fnl
├── init.fnl
├── lsp.fnl
├── macros
│   ├── core-macros.fnl
│   └── vim-macros.fnl
├── mapping.fnl
├── options.fnl
├── plugin
│   ├── anywise-reg.fnl
│   ├── camel-case-motion.fnl
│   ├── colorscheme.fnl
│   ├── compe.fnl
│   ├── conjure.fnl
│   ├── devicons.fnl
│   ├── file-explorer.fnl
│   ├── gitsigns.fnl
│   ├── hexokinase.fnl
│   ├── hlslens.fnl
│   ├── indent-blankline.fnl
│   ├── lightbulb.fnl
│   ├── lspkind.fnl
│   ├── lspsaga.fnl
│   ├── navigator.fnl
│   ├── nrpattern.fnl
│   ├── slime.fnl
│   ├── spellsitter.fnl
│   ├── statusline.fnl
│   ├── telescope.fnl
│   ├── tmux.fnl
│   ├── traces.fnl
│   ├── treesitter.fnl
│   ├── trouble.fnl
│   ├── which-key.fnl
│   ├── wilder.fnl
│   └── window.fnl
├── plugin.fnl
└── utils
    └── io.fnl

@Olical
Copy link
Owner Author

Olical commented Sep 7, 2021

Hm, so odd, I can't reproduce that but I'll try to some time soon. I'm clearly missing something since it works absolutely fine for me, so maybe I'm doing something extra that I forgot about.

Do you have some config for aniseed#env that moves the default fnl/lua directory paths?

@datwaft
Copy link

datwaft commented Sep 7, 2021

This is my init.lua file:

local execute = vim.api.nvim_command
local fn = vim.fn
local fmt = string.format
local pack_path = fn.stdpath("data") .. "/site/pack"
local function ensure(user, repo)
  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
ensure("wbthomason", "packer.nvim")
ensure("Olical", "aniseed")
vim.g["aniseed#env"] = {module = "core.init"}

As you can see I am doing vim.g["aniseed#env"] = {module = "core.init"} as per the documentation (at least the documentation of when I created the configuration).

@datwaft
Copy link

datwaft commented Sep 7, 2021

Even with let g:aniseed#env = v:true it fails.

@Olical
Copy link
Owner Author

Olical commented Nov 14, 2021

This is actually working fine for me now so I think I fixed it a while back in other changes? Please reopen if not!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants