by wruza · 2y ago · 0 comments
- couldn’t re-'columns' itself on window resize
- couldn’t be used as an explorer’s “open with” action (due to nvim-qt/nvim argument forwarding nonsense)
- another outstanding bug/non-feature that I don’t remember now, but it was just stupid.
Okay, I thought, give it some time. I gave it some time every two years since 2018-ish. Guess what.And tbh, Lua, really? I mean, it’s better than vimscript, but having such opportunity and choosing Lua is just… no words. It wasn’t even unclear future, the whole point of neovim was making IDE out of it. This is a “typed lang with a rich ecosystem” class of task, not “embedded scripting with no batteries and barely working pm”. I bet that people who actually write plugins wish it was typescript or python multiple times a day.
It’s the fastest scripting language and it’s easy to embed it into the application.
The ‘batteries’ can be found in `:h lua.txt`, they’ve grown significantly each release, and you can even use a package manager.
The ‘batteries’ can be found in `:h lua.txt`
https://neovim.io/doc/user/lua.html
Reinventing iteration, vim.NIL, empty dict, utf-8, etc. Sorry for the snark, but I'm not surprised in the slightest and have no other emotion for that. They could have that and a whole world of packages and tools out of the box by using virtually any language except Lua.
Most scripting languages are embeddable. lang.exe and /usr/bin/lang are just cli frontends to lang dlls and do baseline embedding like `exit(luaL_dofile(L, argv[1]))`, which is one of Lua’s selling points until you start actually binding it to your runtime and this simplicity drowns in necessity of reinvention.
I’ve embedded Perl, Python, Lua in real projects. Didn’t touch Node.js, but pretty sure it embeds as well as long as you’re happy to deal with C++. Judging by the experience with C++ modules for node, it’s not that bad, but not that trivial either. Python, js, ts are all fine candidates with massive mature ecosystems.
Technically, all you do in embedding is: set up the interpreter, define some modules (or globals), these modules export objects or functions which are implemented in C via embedding API. Then you run scripts from strings or files. These scripts use these modules, e.g. vim .get_tab(3) .get_cur_window() .set(“filetype”, “sh”), or you can add metatable/class sugar on top of it. Nothing unique to Lua there.