Custom config

Make your own config :

  • Create custom folder in lua/
  • Copy the /examples dir files in this custom dir.
  • Check siduck’s custom config as a reference!
  • Below are just examples bruhh

Change default options

  1. M.options = {
  2. user = function()
  3. vim.opt.number = false
  4. end,
  5. }
  6. -- or just load the module with your options
  7. M.options = {
  8. user = function()
  9. require("custom.myoptions")
  10. end,
  11. }

Add plugins

  1. -- custom/plugins/init.lua
  2. return {
  3. ["elkowar/yuck.vim"] = { ft = "yuck" }
  4. ["NvChad/nvterm"] = {
  5. config = function()
  6. require "plugins.configs.nvterm"
  7. end,
  8. },
  9. }
  • you can use a table too or just link the path of your table to organize config clean!
  1. -- chadrc.lua
  2. M.plugins = {
  3. user = require "custom.plugins"
  4. }

Replace default config of a plugin

  • Use the default_plugin_config_replace table in chadrc.lua
  1. M.plugins = {
  2. user = {
  3. ["NvChad/nvterm"] = {
  4. config = function()
  5. require "custom.nvterm"
  6. end
  7. }
  8. },
  9. }
  • Do :PackerSync

Override default config of a plugin

  • This feature comes useful when you want to change one thing from default config of a plugin but not copy paste the whole config!
  1. M.plugins = {
  2. override = {
  3. ["nvim-treesitter/nvim-treesitter"] = {
  4. ensure_installed = {
  5. "html",
  6. "css",
  7. },
  8. }
  9. }
  10. }
  • Note : the word ‘nvim_treesitter’ is taken from the override function from /lua/plugins/init.lua’s treesitter ‘use’ table.
  • The above method might get messy if you override many plugin configs, so below is a basic example to keep it clean :
  1. local pluginConfs = require "custom.plugins.configs"
  2. M.plugins = {
  3. override = {
  4. ["nvim-treesitter/nvim-treesitter"] = pluginConfs.treesitter,
  5. ["kyazdani42/nvim-tree.lua"] = pluginConfs.nvimtree,
  6. },
  7. }
  1. -- custom/plugins/configs.lua file
  2. local M = {}
  3. M.treesitter = {
  4. ensure_installed = {
  5. "lua",
  6. "html",
  7. "css",
  8. },
  9. }
  10. M.nvimtree = {
  11. git = {
  12. enable = true,
  13. },
  14. view = {
  15. side = "right",
  16. width = 20,
  17. },
  18. }
  19. return M

Local themes

  • Default themes are in our nvim-base16 repo’s hl_themes dir
  • Any nvchad theme structure be like :
  1. -- siduck.lua = theme name
  2. local M = {}
  3. M.base_30 = {
  4. -- my colors
  5. }
  6. M.base_16 = {
  7. -- my base16 colors
  8. }
  9. return M
  • Make sure to use the exact variable names!

  • Then put your theme file in /custom/themes dir , ex : custom/themes/siduck.lua

  1. M.ui = {
  2. theme = "siduck",
  3. }
  • NOTE: The telescope theme switcher is still WIP so u have to add theme name in chadrc manually for now.

Override specific colors in themes

  1. M.ui = {
  2. changed_themes = {
  3. onedark = {
  4. base_16 = {
  5. base00 = "#mycol",
  6. },
  7. base_30 = {
  8. red = "#mycol",
  9. white = "#mycol",
  10. },
  11. },
  12. nord = {
  13. -- and so on!
  14. },
  15. },
  16. }

Override default highlights

  • This method can also be used to add your own highlight groups too
  • Make sure you use a valid highlight group!
  • check your theme at :
  1. ~/.local/share/nvim/site/pack/packer/opt/base46/lua/hl_themes
  • Over there, in your theme file ex : onedark.lua, only the variables from base_30 can be used in overriding your custom highlight groups.
  • You can even use hex colors in fg/bg field but its preferred to use variable names ex : blue, darker_black, one_bg etc from your theme file as it’ll integrate better.
  • So no need to import a color table etc
  1. M.ui = {
  2. hl_override = {
  3. --override default highlights
  4. Pmenu = { bg = "white" },
  5. MyHighlightGroup = {
  6. fg = "red",
  7. bg = "darker_black"
  8. }
  9. },
  10. }
  • NOTE: check our base16 repo’s integration section to know the default hl groups used
  • You can even use the path of the table in hl_override table (make sure u load it in variable before) like :
  1. -- custom.highlights
  2. return {
  3. Pmenu = { bg = "#ffffff" },
  4. MyHighlightGroup = {
  5. fg = "blue",
  6. bg = "grey"
  7. }
  8. }
  1. -- chadrc
  2. local my_highlights = require("custom.highlights")
  3. M.ui = {
  4. hl_override = my_highlights
  5. }

Remove plugins

  1. M.plugins = {
  2. remove = {
  3. "andymass/vim-matchup",
  4. "NvChad/nvterm",
  5. },
  6. }
  • Do :PackerSync

Modify plugin definition options

  • For example this is nvimtree’s definition
  1. ["kyazdani42/nvim-tree.lua"] = {
  2. cmd = { "NvimTreeToggle", "NvimTreeFocus" },
  3. setup = function()
  4. require("core.mappings").nvimtree()
  5. end,
  6. config = function()
  7. require "plugins.configs.nvimtree"
  8. end,
  9. }
  • Now to change cmd, setup or any option defined in it :
  1. M.plugins = {
  2. user = {
  3. ["kyazdani42/nvim-tree.lua"] = {
  4. cmd = { "abc"},
  5. setup = function()
  6. require("core.mappings").yourfile
  7. end,
  8. config = function()
  9. your stuff!
  10. end,
  11. }
  12. } }
  • Do :PackerSync

Enable dashboard

  1. local M = {}
  2. M.plugins = {
  3. user = {
  4. ["goolord/alpha-nvim"] = {
  5. disable = false,
  6. },
  7. },
  8. }
  9. return M
  • Do :PackerSync
  • The above is an example, its better to put alpha in your custom plugins list table which is most probably in another file if you like organizing stuff

Packer Snapshot

  • Lets run :PackerSnapshot stable_chad (this command creates new snapshots)
  • my chadrc could look like this
  1. M.plugins = {
  2. override = {
  3. ["wbthomason/packer.nvim"] = {
  4. snapshot = "stable_chad",
  5. }
  6. }
  7. }
  • In case there’s a breaking change, I can just do :PackerSnapshotRollback stable_chad and wait for 1-2 minutes
  • To delete that snapshot, PackerSnapshotDelete stable_chad

Autocmds

  • for example you can create a new file called autochad_cmds.lua in the lua/custom folder and require it in lua/custom/init.lua! or just define autocmds in custom/init.lua

Files to edit

  • Only edit files in custom dir, dont touch anything outside it.
  • The rest of the files outside the custom folder will get overwritten when updated using <leader> + uu .

Lazy loading

  • We lazy load almost 95% of the plugins, so we expect you to lazy load the plugins you’ve added to reduce startuptime. We don’t want users making NvChad slow just because they didn’t lazy load plugins they’ve added!

  • Check packer’s readme for more info!

lessgooo

(Note : Please open out an issue on the repo if you find any inaccuracies in the docs!)