Correct way to add configs #2815
-
What is the suggested way to add personal configs to plugins that already exist from NvChad? /* plugins/init.lua */
{
"hrsh7th/nvim-cmp",
config = function()
require "configs.cmp"
end,
},
{
"nvim-tree/nvim-tree.lua",
config = function()
local opts = { view = { side = "right" } }
require("nvim-tree").setup(opts)
end,
}, /* configs/cmp.lua */
local cmp = require "cmp"
cmp.setup {
sources = {
{ name = "nvim_lsp" },
},
mapping = cmp.mapping.preset.insert {
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<CR>"] = cmp.mapping.confirm { select = true },
["<C-Space>"] = cmp.mapping.complete(),
},
} Here is a sample of my config files. Is this correct? Am I accidentally overwriting the entire table from NvChad? |
Beta Was this translation helpful? Give feedback.
Answered by
siduck
Apr 30, 2024
Replies: 1 comment 4 replies
-
@parthshahp look at the plugin examples here https://nvchad.com/docs/config/plugins/ so for small changes or changes which dont have any function call , use the or you could do within the config function itself {
"blabla cmp",
config = function(_, opts)
opts.blablabla -- change the opts table by LUA!!
require("cmp").setup(opts)
end
} |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
siduck
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@parthshahp look at the plugin examples here https://nvchad.com/docs/config/plugins/
so for small changes or changes which dont have any function call , use the
opts
as table, else use opts as a function ( for cmp's case )or you could do within the config function itself