LazyVim / starter

Starter template for LazyVim
Apache License 2.0
1.01k stars 800 forks source link

Remove importing Extras from the example #52

Open istepic opened 9 months ago

istepic commented 9 months ago

Importing Extras from plugins/ folder can have consequences on the configuration of the plugin that's enabled in the Extras. lazy.nvim loads plugins alphabetically from plugins/ folder which can mean that some plugins will have configuration based on the order in which they are loaded. When configuration options are getting merged this has no effect. But when configuration option is supposed to get completely replaced this can be a problem. For more details see LazyVim/LazyVim/issues/2567.

Extras documentation recommends using :LazyExtras command or importing extras in config/lazy.lua. Example should be consistent with that recommendation.

testfailed commented 9 months ago

I prefer to the config file form to setting extras options and I got to know it from the comment on the example.lua. I think removing the instruction from the example could make people like me more hard to use of it or even forcing them to use menu options not knowing about config file usage.

Maybe could it be solved by syncing extras options on a some kind of auto-generated config file?

e.g.

lua/
|- config/
|  |- ...
|  |- lazy.lua
|  |- _extras.lua <--- it's auto-generated and synced with extras options on the setting.
|- plugins/
   |- ...

and in lua/config/_extras.lua

-- lua/config/_extras.lua
-- (Some warning/instruction messages like below)

-- IT'S AUTO-GENERATED FILE!
-- It would be automatically updated on toggling extras options on the setting.
-- Commented line means it is DISABLED and you can uncomment it to set it ENABLED.
-- Your changes here will also applied to the extras setting.
-- Refer to the link for a full list of manual: https://www.lazyvim.org/extras

-- Sorry about awkward example below. I'm new to lua and lazyvim. 
require("lazy").extend_setup({
  spec = {
    -- { import = "lazyvim.plugins.extras.coding.codeium" }, -- Commented means DISABLED
    { import = "lazyvim.plugins.extras.coding.copilot" },    -- Uncommented means ENABLED
    { import = "lazyvim.plugins.extras.coding.native_snippets" },
    -- { import = "lazyvim.plugins.extras.coding.tabnine" },
    { import = "lazyvim.plugins.extras.coding.yanky" },
    { import = "lazyvim.plugins.extras.dap.core" },
    { import = "lazyvim.plugins.extras.dap.nlua" },
    { import = "lazyvim.plugins.extras.editor.aerial" },
    -- { import = "lazyvim.plugins.extras.editor.leap" },
    -- { import = "lazyvim.plugins.extras.editor.mini-files" },
    { import = "lazyvim.plugins.extras.editor.symbols-outline" },
    { import = "lazyvim.plugins.extras.editor.navic" },
    { import = "lazyvim.plugins.extras.formatting.black" },
    { import = "lazyvim.plugins.extras.formatting.prettier" },
    -- ...
  },
})