Hacker News new | ask | show | jobs
by Normille 1365 days ago

  >Neovim ... supports LUA script for config and plugins
Except it doesn't really. Or at least it's very basic. I'll re-post a comment I made on this, when it was discussed a while back [0]

https://news.ycombinator.com/item?id=32624308

----

I've been using Neovim for several years now. Not for any real reason, other than "Let's try 'new & shiny'" when it first emerged. Last week I thought I'd finally get round to converting my existing Neovim init.vim config [which had itself been inherited and developed from my earlier Vim .vimrc one] to Lua [not a language I'd ever used before. But the syntax looked fairly straightforward].

What a waste of time! The easy stuff [enabling/disabling various options] was easy. But then it's easy in Vimscript too. The difficult stuff [defining autocmds, managing my plugins] was either completely ignored in every single "convert your init.vim to to init.lua" tutorial I read... or required wrapping the existing Vimscript block in

  vim.cmd[[ ... ]]
in Lua because Neovim's Lua support can't yet do a lot of this stuff natively. Oh, and this also had the brilliant side-effect of removing syntax highlighting from great swathes of my config file as everything inside vim.cmd[[ ... ]] is rendered as a comment. I spent the best part of a day wrestling with converting to init.lua, left it overnight and then, in the morning thought Why the fuck am I wasting time trying to beat this into shape, when my existing vim.init is already set up exactly how I want it?" and I reverted back to good ol' crusty ol' unfashionable Vimscript.

YMMV if you're actively developing plugins and want to use a more widely utilised language to write them in. But for configuring Neovim itself, Lua is more hassle than it's worth.

3 comments

The Neovim API is more fully baked now than it was.

I went through the same thing back in the day… now it’s a breeze and I’ve never coded in Lua before. Part of the problem was different users suggesting different things.

"Build your first Neovim configuration in lua” is a good introduction [1].

[1]: https://vonheikemen.github.io/devlog/tools/build-your-first-...

I found this very helpful when switching to nvim recently. Kudos to the author for having the nvim config on github and making videos explaining how he set it all up:

https://github.com/LunarVim/Neovim-from-scratch

https://www.youtube.com/watch?v=ctH-a-1eUME&list=PLhoH5vyxr6...

I gotta say, the Neovim guys are killin’ it on YouTube and Twitch.

They’re reaching a new generation of Neovim/Vim users.

Couple things. Over the last year, the lua API has expanded. You can now do almost everything with only lua! Autocmds, commands, plugin management - all in lua. Even key-mappings can call lua closures directly! And with treesitter, the strings in `vim.cmd([[...]])` calls get highlighted as vimscript.

Not saying you should give it another go, just that your info is out of date ;)