How does NvChad work?
Understanding the basics
Before getting into the topic, first you should understand the vim.tbl_deep_extend
function which is used for merging tables and their values recursively.
- The function
vim.tbl_deep_extend
is normally used to merge 2 tables, and its syntax looks like this:
-- table 1
local person = {
name = "joe",
age = 19,
skills = {"python", "html"},
}
-- table 2
local someone = {
name = "siduck",
skills = {"js", "lua"},
}
-- "force" will overwrite equal values from the someone table over the person table
local result = vim.tbl_deep_extend("force", person, someone)
-- result :
{
name = "siduck",
age = 19,
skills = {"js", "lua"},
}
-- The list tables wont merge cuz they dont have keys
Main Config Structure
- NvChad/NvChad repo, this contains plugins, options, mappings, autocmds.
- NvChad/starter - This is a minimal config which shows how to use the nvchad repo as a plugin.
- Users will be using the starter config or can create their own
config structure of the main nvchad repo :
├── lua/
│ ├── nvchad/
│ │ ├── autocmds.lua
│ │ ├── mappings.lua
│ │ └── options.lua
│ ├── plugins/
│ │ ├── init.lua
│ │ └── ui.lua
│ └── configs/
│ ├── cmp.lua
│ └── more..
└── nvconfig.lua
- example module import,
require "nvchad.options"
- nvconfig.lua is the list of all options for both ui/base46 repo!
Chadrc.lua
- This file is meant to have structure of nvconfig.lua, check the nvconfig.lua for knowing all supported options.
- So nvconfig returns a table of config and then merges chadrc's table.
- And you put this file in your
/lua
folder
Themes
You can see all the themes with the following keymap: <leader> + th
.
The
leader
key is the space in NvChad.
Mappings
If you want to know all the keymaps, you can run the following commands:
NvCheatsheet
Telescope keymaps