This configuration uses lazy.nvim as the package manager. All plugins are automatically loaded from the lua/plugins/ directory structure.
Plugin structure
Plugins are organized into three main import groups:
plugins - General plugins (UI, editing, productivity)
plugins.languages - Language-specific plugins (TypeScript, Go, Markdown)
plugins.lsp - LSP configuration and related plugins
These import groups are defined in lua/core/lazy.lua:27-30.
Adding a new plugin
Create a plugin file
Create a new Lua file in the appropriate directory:lua/plugins/my-plugin.lua
return {
"author/plugin-name",
enabled = true,
lazy = false,
opts = {
-- Plugin configuration options
},
}
Configure the plugin
Add your plugin configuration. Here’s a complete example from the theme configuration:return {
{
"sainnhe/gruvbox-material",
enabled = true,
lazy = false,
priority = 1000,
init = function()
vim.cmd.colorscheme("gruvbox-material")
vim.g.colors_name = "gruvbox-material"
end,
},
}
Restart Neovim
lazy.nvim will automatically detect and install the new plugin on next startup.
Plugin configuration options
Common options
return {
"author/plugin-name",
enabled = true, -- Toggle plugin on/off
lazy = false, -- Load immediately vs lazy-load
priority = 1000, -- Load order (higher = earlier)
dependencies = { -- Required plugins
"other/plugin",
},
}
Language-specific plugins
For language-specific functionality, create files in lua/plugins/languages/:
lua/plugins/languages/typescript.lua
return {
{
"dmmulroy/ts-error-translator.nvim",
enabled = true,
opts = {
auto_attach = true,
servers = {
"tsgo",
},
},
},
}
Language plugins are automatically imported via the { import = "plugins.languages" } spec in lazy.lua:29.
Example: Go plugin configuration
Here’s a real-world example showing advanced plugin configuration with dependencies and custom setup:
lua/plugins/languages/lessgo.lua
return {
{
"ray-x/go.nvim",
enabled = true,
dependencies = {
"ray-x/guihua.lua",
"nvim-treesitter/nvim-treesitter",
"neovim/nvim-lspconfig",
"saghen/blink.cmp",
},
config = function(_, opts)
require("go").setup({
lsp_keymaps = false,
lsp_codelens = false,
lsp_on_attach = false,
lsp_cfg = false, -- disable go.nvim LSP, using lspconfig instead
diagnostic = false, -- using tiny-diagnostics + nvim-lint instead
luasnip = false,
})
end,
ft = { "go", "gomod" }, -- Only load for Go files
},
}
Lazy.nvim configuration
The main lazy.nvim setup includes these settings:
require("lazy").setup({
change_detection = {
enabled = true,
notify = false,
},
dev = {
path = "~/myCodes", -- Local plugin development
},
ui = {
border = "rounded",
backdrop = 80,
title_pos = "left",
},
install = { colorscheme = { "gruvbox-material" } },
checker = {
enabled = true, -- Check for updates periodically
notify = false,
frequency = 360, -- Every 10 hours
check_pinned = true,
},
})
Disabling built-in plugins
For better performance, several built-in Neovim plugins are disabled:
performance = {
rtp = {
disabled_plugins = {
"gzip",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
}
Disabling built-in plugins can affect functionality. Only disable plugins you’re certain you don’t need.
Switching between plugins
To switch between alternative plugins, use the enabled flag:
return {
{
"sainnhe/gruvbox-material",
enabled = true, -- Active theme
priority = 1000,
init = function()
vim.cmd.colorscheme("gruvbox-material")
end,
},
{
"comfysage/gruvboxed",
enabled = false, -- Alternative theme (disabled)
priority = 1000,
init = function()
vim.cmd.colorscheme("gruvboxed")
end,
},
}
Commands
Useful lazy.nvim commands:
:Lazy - Open lazy.nvim UI
:Lazy update - Update all plugins
:Lazy sync - Install missing and update plugins
:Lazy clean - Remove unused plugins
:Lazy profile - Profile startup time
:Lazy log - Show recent updates
Changes to plugin files are automatically detected. The lazy.nvim UI will show a notification when changes are detected.