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.

  1. ├── init.lua
  2. ├── lua
  3. ├── core
  4. ├── autocmds.lua
  5. ├── default_config.lua
  6. ├── mappings.lua
  7. ├── options.lua
  8. └── utils.lua (i)
  9. ├── plugins
  10. ├── init.lua
  11. ├── packerInit.lua
  12. └── configs
  13. ├── bufferline.lua
  14. ├── others.lua
  15. └── many more plugin configs
  16. | |
  17. ├── custom *
  18. ├── chadrc.lua
  19. ├── init.lua
  20. ├── 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!

chad lessgooo

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 :

  1. M.options = {}
  2. M.ui = {}
  3. M.plugins = {}
  4. 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 :
  1. ["org or username/reponame"] = {
  2. config = function()
  3. path to config ( require it)
  4. end
  5. }
  6. -- example
  7. ["max397574/better-escape.nvim"] = {
  8. config = function()
  9. require("plugins.configs.better_escape")
  10. end
  11. }
  12. -- packer's original way of defining plugins :
  13. use {
  14. "max397574/better-escape.nvim",
  15. config = function()
  16. require("plugins.configs.better_escape")
  17. end
  18. }