Olical / aniseed

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

Dont know what is the best way to implement ftplugin-like functional #110

Closed D00mch closed 2 years ago

D00mch commented 2 years ago

Best thing I came up to is to run an autoload. Example (commit) with loading clojure.fnl

Is it ok that way or is there a better approach?

Olical commented 2 years ago

Looks okay to me! If that works for you I'd stick with it. The only other approach I'd suggest requires looking in :h api at the functions you have available to you under the vim.{method} global Lua table.

If there's a function for registering autocmds you could use that instead of ex commands which is really just VimL. I find avoiding VimL interop wherever you can makes things easier.

You may be able to call an autocmd function from the API that takes a Lua function directly, which means you could wrap your Clojure setup code in a function and call it when the autocmd fires.

If that all works out and you find a function, you could even move your Clojure module require to an aniseed autoload in the module macro, then your autocmd just calls your setup method when you get into Clojure land and Aniseed will handle requiring it lazily for you.

What you have is already good, nothing wrong with it, this is just what I would look into. I hope this helps!

Olical commented 2 years ago

Closing since I think you have what you need 😄 please re-open if something goes wrong!

D00mch commented 1 year ago

I solved the problem by using symlinks. Commit example: https://github.com/D00mch/dotfiles/commit/752aa3c1793073da33b7ed920c638c8300e7c247 But this way, it seems, I can't use aniseed defined functions, only core fnl.