I rewrote my Vim config in Lua. Was it worth it?

preview_player
Показать описание


0:00 Intro
0:15 Why Lua?
4:17 Lua basics
6:19 Setting options in Lua
8:18 Setting a leader key (and global variables)
10:04 Setting keybindings in Lua
11:48 Sourcing different files with require
13:48 Loading Vim plugins in Lua
17:00 Was it worth it?
17:41 Additional resources
18:11 Conclusion
Рекомендации по теме
Комментарии
Автор

"Just to procrastinate on something more important". Truer words were never spoken

Sodo
Автор

Nice video as usual
Lots of things to learn with your content. Always very complete, useful, detailed and compact in optimal video length.
As you talk about Lua, it would be very interesting to see your take on conky and conky manager (MX linux style), or valid and more recent alternatives (not just widgets).

albertoleo
Автор

Even though I dont use Neovim as much anymore, I think it was a good transition since alot of the plugins with awesome features for neovim are in Lua and you have to configure them in Lua

GravychiroAshina
Автор

You said that when passing a single argument to a function, the parens can be omitted. That’s not quite true. The parens can only be omitted when the single argument is a string literal or a table constructor. You cannot omit the parens when passing a variable, a number, or a boolean.

MarkVolkmann
Автор

Chatgpt is good at this vimscript to lua conversion.

arielfrischer
Автор

Wanting to be one of the cool kids, I tried this months ago, and I gotta say it was not a pleasant experience. So here are my two cents (I'm not discouraging people here, btw, just throwing a kind of warning to the n00bs): There's not a lot of documentation (that I could find) on how to switch *all* your Vimscript settings into Lua, so if you have an obscure option set up for a particular perhaps-not-very-well-known plugin, good luck translating that into Lua. Whereas your vimrc has everything in one place, your nvim init will probably be divided into subdirectories. For me, that got old really quick. It's not fun hunting down errors through multiple files! As a way to save me the trouble, I thought about simply copying or emulating someone else's Lua config... Again, good luck going through that maze without knowing any Lua! Now, sure, you could take the time to learn that language, but from my understanding, it's not one of the big ones (like Python or JavaScript) so usability will be kind of limited. So unless you already have some programming languages under your belt, I wouldn't start with Lua. After two days of struggling, I simply configured my neovim with old Vimscript, which I completed in a jiffy.

Again, in principle, I'm not against configuring neovim in Lua. It's just that the actual execution is a bit of a PITA.

AnalyticMinded
Автор

oh, how long you delayed this transition

mykytao
Автор

I think you've just convinced me to not use Lua or NeoVim. I'm still going to learn Lua, but that's sort of an ancillary goal as I write an embedable language to get ideas on how I "should" implement things. I do see it used for a lot of game projects, like PICO-8 and Love2D, but that seems absolutely bonkers to me. There's loads of quirks I keep finding out about and in looking at the source code for the language I feel a little bit like throwing up. Maybe it's just me, but I don't think people should trust it as a language.

anon_y_mousse
Автор

Recomendation: Create a loop to simplify the map.

function map(mode, lhs, rhs, opts)
local opts = opts or { silent = true }
vim.keymap.set(mode, lhs, rhs, opts)
end

map('i', 'kj', '<esc>')
....

vitormelo