Neovim 0.12
Lazy is no longer needed as a means of fetching remote plugins, however, I dont know that the updated T383838vim.pack can handle lazy loading based on file type. That's the other benefit to Lazy, but I don't know how much it impacts anything, yet. And I'm not going to explore that just yet. Instead, I want to see how much simpler I can make my configuration.
Instead of Lazy
In the same way that Lazy can take T383838specs and fetch remote plugins, so can T383838vim.pack. I need to experiment more to see if the configuration is also as easily embedded, but generically here's how it works.
The following is passed to lazy:
local plugins = {
spec = {
{
"short-or-longform-url",
ft = "whatever-type",
name = "whatever",
},
-- other options like install/checker/…
}
}
require("lazy").setup(plugins)
For T383838vim.pack just pass the items in the spec map, that is:
vim.pack.add({ src="longform-url", name="whatever" })
require("whatever").setup(…)
To use a short-form url, the help page for T383838vim.pack.add suggests creating wrapper functions or using a git feature that can replace prefixes. But what about passing the initial configuration? In Lazy you can pass the configuration inside the spec. I don't see anything for that in T383838vim.pack, but that doesn't mean it isn't there, it just means I haven't seen it yet.
And I guess since it's not lazy loading, it can just be put into the top level configuration or put into some event to get something like lazy loading. I have more experimenting to do!
does this shorten my config?
The simplest things don't get any shorter -- all those color schemes were just one line, anyway. But the LSP configuration, there's a lot of potential there. What doesn't get shorter -- all the config work to call telescope for various LSP-related actions. I can eliminate the blocks that just loop over and call enable for a given server, now it's just globally enabled (if it's enabled). But I do still have to pass configuration information. But enabling the basic functionality, that becomes this:
vim.lsp.enable({"lsp1", "lsp2", …})
All the exmaples of people using it that I've seen still feature installing T383838nvim-lspconfig, but I'm not sure why.
Anyway, it kind of looks like my config wont get much shorter from the new changes, but in looking at it, I'm noticing there's a lot of stuff that I turned off in my config but that I didn't rip out. My config overall could be a lot shorter and cleaner.
Tags: neovim, cli
Tags
Navigation