Hacker News new | ask | show | jobs
by typon 1295 days ago
I dont know if its me but I find it utterly incomprehensible to read any Lua plugin in neovim. The API is magic and Lua itself isnt a very good language. That is to say, it didnt really get any better than vimscript. Ive written a couple of plugins in vimscript back in the day so i know the pain.
3 comments

"Lua itself isnt a very good language" is very subjective.

The API is pretty well documented now I think? If there is a specific area that isn't, then file a bug or write the docs. It is an open source project and thus is heavily depends on people contributing to make things better.

I use neovim heavily and I spend the first five minutes of my morning thanking the developers for their hard work - without their selflessness we wouldn't have the best text editor in the world. I was just commenting on whether the purported benefits of using Lua over Vimscript as the core scripting language really panned out. Clearly a lot of people think they did.
I haven't implemented this yet, but one thing I'm looking forward to is lua libraries. I have a data YAML that carries some autocomplete information. To use it with a vimscript function I had to convert it to a JSON first. With lua I should be able to use a library to just read the YAML directly.
I disagree that Lua isn’t a good language. As a general purpose language, it is better than Vimscript, which sort of expanded into a general purpose language by fits and starts, and often not very cleanly.

Vimscript9 fixes some of this, but it is still focused on being a special purpose language (scripting vim) far more than being a general purpose language.

I agree with you that the neovim / Lua bridge is substandard and poorly documented, and way too magic. There’s too much distance between Lua and the vim model that isn’t well bridged by the API that has been written.

Certain things are better for neovim with Lua, because you can (in theory) take advantage of all that Lua has via luarocks. But that bridge back to the editor is still ugly, and I don’t like it.

I find the opposite being the case for me, it's a joy for me reading plugin code now and being able to understand and easily modify it.