[opinion] Including Lua and treesitter in neovim was the right decission

I know, the team/enthusiasts behind neovim are smart people, they took a decission based on their wisdom and they are sure about it, they don’t need any reassurance on the topic, even less if it is the random opinion of some random guy on the internet. But then I thought: If most people are not holding their bad opinions about things, why should I deprive me of writing mine just because it is about saying good things?

Look, I tried to use vim and latter neovim as my main code editor every 6 months since 2012, and I failed miserably every time. I was not able to handle the mental overhead of having to keep all the editor metadata in my own head: “which files are open, how can I switch to that file I know is lying around, where on the folder hierarchy am I, how can I make a global live search while I see the results nicely”, all on that on top of the highly intellectual task that coding is.

But a couple of months ago, the 6 months phase restarted and I decided to waste some days of my life on this task as the tradition dictates. Luckly, I found LunarVim, a very polished neovim distrubution, with an awesome community, and what is better, an spectacular selection of plugins that made the tasks of using neovim a pleasant experience from the very beginning. Why is this relevant to this topic? Well, because this introduced me to the huge (and new) ecosystem of plugins written in lua, the advantages of configurations written in lua, and… LUA love.

When I first read that Neovim was going to embed lua as a scripting option, I was not excited about it. I never used that language, was not attracted to it, and I had already a big vimscript configuration that I crafted (AKA copied from other people’s dotfiles) that I barely understood, so porting it to lua was not going to be a doable task.

However, as I mentioned above, thanks to LunarVim I decided to ditch my own configuration and stick to theirs and just add my little required fine-tunes to it. And, wow, what a nice experience this was, and mostly thanks to Lua! It felt like having a nice editor as VSCode but with the ability to easily hack it and blend it to my needs, no matter how stupid my requirements were!

VimScript, is a good DSL to configure vim, that is without a doubt, but it is not suitable for anything more advanced that a couple of mappings and settings variables here and there, it is full of quirks and weirdness once you get out of that specific scope.
Every time I wanted to do anything slightly advanced, even if I had the feeling that it was possible to do X with vim, the weirdness and quirks of vimscript always stopped me from trying it further.
But now with Lua, it is quite the opposite story. All I have to do is create a new file, drop my idea in the form of simple lines of code in easy to grasp syntax of a nice language, require it from my main file, and I’m done. No weird escaping sequences, not extraneous string concatenation, no VimScript specific things to keep in mind, just good old plain coding.

My primary programming language is JavaScript, and I have to say that Lua feels a lot familiar, and if you already know (not just not barely use it!) JavaScript, all what is usually considered advance or weird about Lua is already familiar to you (closures, prototype inheritance, variable shadowing, etc). So now not only all Lua programmers are capable of write vim plugins, but also many JavaScript programmers are potential NeoVim plugin authors! Can you think about some other editor that allows you to write plugins in JavaScript? Yes, exactly, the most used editor nowadays, VSCode. And in my opinion, NeoVim has the potential to become the VSCode editor of terminal lovers just because this very reason.

In the very recent (months? years? I don’t know) I saw a tremendous explosion of plugins written in lua, of HIGH quality. This last part is very important, HIGH quality. They feel polished end products that just look and behave as you expect from a well established editor. And this was key for my comeback.
Plugins like Telescope, nvim-cmp, which-key (the lua one), nvim-tree, lualine, and others were key to my comeback. They gave enough visual belts and whistles to allow me navigate and use NeoVim in a more visual way, reducing the mental overhead required and letting me focus on my tasks.
After this, I decided that I will only install plugins written entirely (or mostly) in Lua. Not because they are better, vim has a lot of excellent plugins, but because I am able to read, understand!, and more importantly, modify and contribute to them. Call we weirdo, but I like to read and understand the code of the tools I use and love.

Thanks to Lua, just after a couple of months of personal config utils development I am now thinking about writing my own NeoVim plugin, just because I have the feeling that it is going to be easy and fun. This would never have been true with Vimscript.

But hey, what about TreeSitter? Well, a lot of the plugins that help me most depend on it, and would have never been possible without Lua and Treesitter. Having super accurate syntax highlighting is just half of the awesomeness of it. Being able to understand the code in a semantic way allowed to properly jump to file references, accurate renames, code specific jumps (ala hop), smart text objects, code structure analysis tools (code outline, accurate position on the status-line, etc). A myriad of awesome little details that really make your life easier.
Sure, it could have been left as an optional plugin, but making it batteries included really encouraged plugin authors to use it, rely on it, and embrace it. It’s awesome.

Sorry for the wall of text! I just wanted to send HUGE thanks to the awesome NeoVim team, to praise the work they do, the innovations they bring and the risks they took on the way.


+1 on Lunarvim. I don’t know if I’d be using (neo)vim without it. As a new user, having a well thought out configuration with some pleasant bells and whistles is a very attractive proposition.

1 Like

Not to mention that the installer is nice enough to not have to override your neovim configuration at all, so you can try it hassle free