-
Notifications
You must be signed in to change notification settings - Fork 2
CustomConfig.md
This guide explains how to customize your Neovim configuration by overriding settings or adding new plugins. By organizing your custom configurations in the nvim/lua/custom/
directory, you can maintain a clean and modular setup.
To override the settings of an existing plugin from the nvim/lua/plugins/
folder, create a corresponding file in the nvim/lua/custom/
directory:
- Identify the plugin you want to customize.
- Create a file named
<plugin_name>.lua
innvim/lua/custom/
. - Inside this file, define a function called
modify_opts
to adjust the plugin's options.
Base Plugin: nvim/lua/plugins/color.lua
return {
"rose-pine/neovim",
name = "rose-pine",
opts = {
theme = "rose-pine", -- Default theme
},
config = function(_, opts)
vim.cmd("colorscheme " .. opts.theme)
end,
}
Override Settings: nvim/lua/custom/color.lua
local M = {}
function M.modify_opts(opts)
opts.theme = "rose-pine-dawn" -- Use a different theme
return opts
end
return M
To add a new plugin or completely replace an existing one, create a file in the nvim/lua/custom/plugins/
directory.
- For new plugins, create a descriptive file name in
nvim/lua/custom/plugins/
. - For overriding an existing plugin, use the same name as the plugin file in
nvim/lua/plugins/
. - Define the full plugin configuration in this file.
New Plugin: nvim/lua/custom/plugins/example.lua
return {
"nvim-treesitter/nvim-treesitter",
name = "treesitter",
opts = {
ensure_installed = { "lua", "python" },
highlight = { enable = true },
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
}
Override Existing Plugin: nvim/lua/custom/plugins/color.lua
return {
"morhetz/gruvbox",
name = "gruvbox",
opts = {
theme = "gruvbox",
},
config = function(_, opts)
vim.cmd("colorscheme " .. opts.theme)
end,
}
- Place files in
nvim/lua/custom/<plugin_name>.lua
.
- Place files in
nvim/lua/custom/plugins/<plugin_name>.lua
.
-
Override Plugin Settings:
- File:
nvim/lua/custom/color.lua
- Purpose: Change the theme of the
rose-pine
plugin.
- File:
-
Add or Override Plugin:
-
File:
nvim/lua/custom/plugins/example.lua
-
Purpose: Add a new plugin (
nvim-treesitter
). -
File:
nvim/lua/custom/plugins/color.lua
-
Purpose: Replace the
rose-pine
plugin withgruvbox
.
-
Feel free to create, modify, or replace plugins using these conventions to suit your workflow!