You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-4
Original file line number
Diff line number
Diff line change
@@ -103,6 +103,7 @@ require("lazy").setup({
103
103
|**ft**|`string?` or `string[]`| Lazy-load on filetype |
104
104
|**keys**|`string?` or `string[]` or `LazyKeys[]`| Lazy-load on key mapping |
105
105
|**module**|`false?`| Do not automatically load this Lua module when it's required somewhere |
106
+
|**priority**|`number?`| Only useful for **start** plugins (`lazy=false`) to force loading certain plugins first. Default priority is `50`. It's recommended to set this to a high number for colorschemes. |
106
107
107
108
### Lazy Loading
108
109
@@ -114,9 +115,6 @@ module of plugin `A`, then plugin `A` will be loaded on demand as expected.
114
115
If you don't want this behavior for a certain plugin, you can specify that with `module=false`.
115
116
You can then manually load the plugin with `:Lazy load foobar.nvim`.
116
117
117
-
Colorscheme plugins can be configured with `lazy=true`. The plugin will automagically load
118
-
when doing `colorscheme foobar`.
119
-
120
118
You can configure **lazy.nvim** to lazy-load all plugins by default with `config.defaults.lazy = true`.
121
119
122
120
Additionally, you can also lazy-load on **events**, **commands**,
@@ -128,6 +126,15 @@ Plugins will be lazy-loaded when one of the following is `true`:
128
126
- it has an `event`, `cmd`, `ft` or `keys` key
129
127
-`config.defaults.lazy == true`
130
128
129
+
#### 🌈 Colorschemes
130
+
131
+
Colorscheme plugins can be configured with `lazy=true`. The plugin will automagically load
132
+
when doing `colorscheme foobar`.
133
+
134
+
> **NOTE:** since **start** plugins can possibly change existing highlight groups,
135
+
> it's important to make sure that your main **colorscheme** is loaded first.
136
+
> To ensure this you can use the `priority=1000` field. **_(see the examples)_**
137
+
131
138
#### ⌨️ Lazy Key Mappings
132
139
133
140
The `keys` property can be a `string` or `string[]` for simple normal-mode mappings, or it
@@ -186,7 +193,15 @@ version of plugins that support Semver.
186
193
```lua
187
194
return {
188
195
-- the colorscheme should be available when starting Neovim
189
-
"folke/tokyonight.nvim",
196
+
{
197
+
"folke/tokyonight.nvim",
198
+
lazy=false, -- make sure we load this during startup if it is your main colorscheme
199
+
priority=1000, -- make sure to load this before all the other start plugins
200
+
config=function()
201
+
-- load the colorscheme here
202
+
vim.cmd([[colorscheme tokyonight]])
203
+
end,
204
+
},
190
205
191
206
-- I have a separate config.mappings file where I require which-key.
192
207
-- With lazy the plugin will be automatically loaded when it is required somewhere
0 commit comments