Understanding the lua cache and how to write an own cache in lua
It is still not documented, what things are required for reloading lua modules. For example,
if one runs :lua print(vim.inspect(package.loaded, { depth = 1 })) one can scroll through the modules.
However, there are neither pointers in the docs nor otherwise blogs on how the internal cache works.
More or less related, I did not find tutorials on how to do caching of function or command arguments with lua.
I’d love to see a guide/tutorial that explains how Neovim works at a high level, preferably with visuals.
I’ve been using Neovim for a few years now, and while I have an ok understanding of my config and some basic lua, I remain pretty confused about how Neovim works at a more fundamental level.
Among other goals, I’d like to do things like adapt terryma’s Vim-Expand-Region plugin for Neovim (it’s currently broken and unmaintained), but I have very little idea of where to begin. And as Richard Feynman said:
What I cannot create, I do not understand.
In trying to improve my understanding of Neovim, I’ve come across the following books, guides, and tutorials. Some are better than others but in general, they mostly seem to be oriented toward showing people how to set up and use Neovim rather than describing how it is built and organized. Judging by the responses in this Reddit thread, that’s what people want when they say that they want to “learn Neovim”, but that’s not really what I’m after.
Nvim help (Site) - it probably has a chunk of what I’m looking for, but it’s tricky to search for concepts you don’t know you don’t know. Creating a mental picture of how everything fits together purely from text is also somewhat challenging (at least for me - “a picture is worth a thousand words” and all that)
Learning to play Vim (Book TOC) - looks like it’ll have a lot of what I’m looking for, but it’s not available yet
The Valuable Dev (Site) - a blog by the author of Learning to play Vim. It appears to contain a chunk of the content that will end up in his book, minus the sections I want most for a more fundamental understanding of Nvim’s architecture
Learn Neovim The Practical Way (Site) - a detailed series on Medium by alpha2phi. The focus is more on setup than on big-picture understanding and building though
Getting started using Lua in Neovim (GitHub, Nvim help) - the amazing Nanotee guide for getting started in Neovim
Neovim IDE from Scratch (GitHub, Videos) - an ambitious series by Chris@Machine that is super helpful for getting up to speed on your config. Slightly dated now.
Vim Casts (Site) - the focus seems to be on using Vim and is a little dated
Modern Vim: Craft Your Development Environment with Vim 8 and Neovim (Book) - doesn’t seem to have in-depth information about Neovim’s architecture
Practical Vim: Edit Text at the Speed of Thought (Book) - not written for Neovim
Build your first Neovim configuration in lua (Site) - a blog that’s mostly about initial setup
Learn How To Use NeoVim As an IDE (Site) - another blog that’s mostly about initial setup
Getting started with Neovim (Site) - an older blog that’s also about initial setup. Still a top hit on Google though.
To be clear, the above content is all amazing and I’m super grateful to have resources and documentation like that available. It just doesn’t seem to quite address some of my remaining knowledge gaps - though I plan on continuing to review and learn from it.
This content shared by @smolck above is very much along the lines of what I’m looking for. I’d be highly interested in having more content like this that’s more recent, more detailed, and contains helpful visuals such as this diagram: