Walkthrough
- (NOTE : Make sure you know basic lua , if not then check).
- Make sure that you read sections in config (in the sidebar of this site) orderwise.
Structure
NvChad comes with the following file / folder structure. An up-to-date & full tree can be viewed in the repo.
├── init.lua
│
├── lua
│ │
│ ├── core
│ │ ├── autocmds.lua
│ │ ├── default_config.lua
│ │ ├── mappings.lua
│ │ ├── options.lua
│ │ └── utils.lua (i)
│ │
│ ├── plugins
│ │ ├── init.lua
│ │ ├── packerInit.lua
│ │ └── configs
│ │ ├── bufferline.lua
│ │ ├── others.lua
│ │ └── many more plugin configs
| |
│ ├── custom *
│ │ ├── chadrc.lua
│ │ ├── init.lua
│ │ ├── more files, dirs
- The file names in the tree with (i) are meant to be ignored , i.e the user doesn’t need to look at them as the lua code in those files might fret you or look very complex / scare you from NvChad xD.
- (note) : custom dir has to be created by the user.
Walkthrough
- Letss goooo!
Init.lua
- NvChads’s config has a lua dir and init.lua.
- The init.lua basically loads the core config and custom config.
- pcall is usually used for error handling . Check lua docs for more info.
Themes
- First copy examples/chadrc.lua to lua/custom/chadrc.lua , make sure it has the theme table
<leader> + th
(<leader>
is<space>
in our config)
Mappings
:Telescope keymaps
Default general options
- This file is lua/core/default_config.lua
- The table below contains all the default options for various stuff in NvChad.
For example :
M.options = {}
M.ui = {}
M.plugins = {}
M.mappings = {} has general mappings
Plugins
- The lua/plugins dir contains three files, init.lua, packerInit.lua.
- packerInit.lua : this file is used for defining packer’s init stuff, so things like clone_timeout , compile_on_sync , etc and other packer related options are mentioned here.
- init.lua : is basically the packer config listing various plugins, it calls packerInit first and then following with definitions of other plugins + their configs’
- For example to add a plugin , packer uses this format :
["org or username/reponame"] = {
config = function()
path to config ( require it)
end
}
-- example
["max397574/better-escape.nvim"] = {
config = function()
require("plugins.configs.better_escape")
end
}
-- packer's original way of defining plugins :
use {
"max397574/better-escape.nvim",
config = function()
require("plugins.configs.better_escape")
end
}