Friendship ended with Vimscript
📝Lua is now my best friend for configuring Neovim.
⚠️ Warning: This post is very cringe as I hate talking about my tools instead of my work. You've been warned.
Looking over my notes for this post, it seems like I've been using Vim in some sort or another for over a decade at this
point? Time flies when you can't
:quit Vim. Folks, I'll be here all week.
I guess I switched to Neovim at some point in 2014? One of the main reasons that Neovim exists is that mainline Vim, historically, resisted allowing configuration in languages that were not Vimscript. Vimscript is… not a good language. People that love it, love it, all the more power to them, but I am not one of them. I recall at some point during my mainline Vim days using some plugins that were written in Python, but those seem to break all the time.
All this time though, I have been maintaining a very detailed and commented Vim config in Vimscript. I have put a lot of sweat equity into this config! Perfecting it got me fired from a job in 2012. Lesson learned, you move on. I even kept it backwards compatible with ancient versions of Vim that I will never encounter in reality. It was fun and made me feel like a hacker. I would see people on Reddit talking about their configs in Lua and I would just tune them out. I have my config and it's already held together with Popsicle sticks and glue. If I even look at it wrong, I'll lose a day of development time.
At some point in 2018, I discovered coc.nvim and it was a revelation. It was added Visual Studio Code's basic code completion features to my super custom Vim config! I could jump to definition! I could have accurate code completion! It probably does a lot more IDE like things, but I'm a simple man and that's all I need. My config would still break from time to time, but at least I became 1.3x more efficient.
I started working at Chord in 2022 and discovered that, for the first time, I had coworkers
that used Vim! I started a little
#vim channel and we got to sharing tips and configs. It's always nice to find
people like you.
On a Friday evening in November, Chad posts his brand new Neovim config written in Lua. Well that just pushed all of us over the Lua cliff and we all spent our weekend updating our configs.
You can checkout how I did this in this pull request!
Chad's base config was a great base that I was able crib into my config as I converted it to Lua. It had all the code completion plugins that I needed to replace coc.nvim. At this point, he had his configs in a bunch of different files, which I have done in the past and hated as it's impossible to find anything easily, but I was able to work around that. (It should be noted that I mentioned my experience with multiple files in the past and he converted his config to a single file).
Without any further ado, let's dive into what this conversion gave me!