vim 2024-02-10

I converted my neovim config from lua to fennel and it’s very slick 🧵

🎉 3

Very slick indeed! Kudos to @olical who is turning Nvim into an editor that can surpass Emacs in terms of extensibility. That's a pretty high bar to cross!

☝️ 1

Cool, i am in the process of trying to convert my config to fennel as well. I really like the concept, but i have ~10 years of accumulated config i want to port and i am finding it a bit of a pain. Especially tracing errors on startup from the lua files back to the fennel source can be very annoying

@nbtheduke Do you have a link to your config? I've considered it myself, but it didn't seem worth it just to have more lisp in my life 😅

Can also recommend https://github.com/rafaeldelboni/cajus-nfnl/ as a good starting point

❤️ 1
👆 2

that's got a lot of the same stuff i use. i find it hard to recommend pre-built configurations as i like to know how all of the pieces fit together and make informed decisions about each one

➕ 1

nfnl is really really nice. i liked aniseed but nfnl is just better

I agree 🙂 What i meant to say is that it is a good good starting point for understanding how to setup a config in fennel using nfnl, as the documentation in nfnl itself is lacking

👍 1

I ended up liking having most of the configuration in Lua, and then some user defined functions in Fennel. Copy pasting Lua snippets from github repos was too convenient 🙂

👍 4

Yeah, that's a really nice positive. Using nfnl makes writing them side by side really easy.

I ended up spending some time converting my config to fennel too, I have to say I like it. Much easier for me to hack on somehow 🤔

There's also this tool which you can convert lua <-> fennel: https://fennel-lang.org/see It might need a refactor, but it's an easy way to get something working quickly 😄

👍 2

However, the primary tree-sitter grammar for fennel doesn’t just parse the forms (list, number, table, symbol, etc), it parses the special forms too, so the ast isn’t (list (symbol “fn”) (symbol “plus”) (seq_table …)), it’s (fn name: (symbol “foo”) (parameters (binding …)))

That’s cool for taking lexical scope from TS, but it makes it impossible to do s-expression manipulation with paredit-like tools

Could you give an example of a problem you had with s-expressions? I've been using the vim-sexp lua implementation and don't recall facing any challenges with fennel.

I use nvim-paredit which is treesitter based, vs vim-sexp which uses syntax highlighting to determine stuff

Interesting! The one I use has a similar name and it's also implemented using tree sitter. Perhaps they're doing something different https://github.com/PaterJason/nvim-treesitter-sexp

Hmmm! I’ll look at that

Oh i see, they’re relying on custom queries for each language, that’s clever. I’m pretty tied to nvim-paredit (I have a bunch of custom mappings and functions), but maybe using custom queries is an easier path than forking tree-sitter-fennel lol

💡 1

Yeah I thought about doing it but eventually gave up, because I don't see enough benefit from it - most of my config is just copied from github anyway.

Seems like a joke but nowadays chatgpt can help you converting from lua to fennel if you guide it a bit