diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index d87fd04..3299925 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -113,21 +113,9 @@ M.misc = function() -- cmd "silent! command! NvChadReload lua require('nvchad').reload_config()" end - local function user_config_mappings() - local custom_maps = config.mappings.custom or "" - if type(custom_maps) ~= "table" then - return - end - - for _, map_table in pairs(custom_maps) do - map(unpack(map_table)) - end - end - non_config_mappings() optional_mappings() required_mappings() - user_config_mappings() hooks.run("setup_mappings", map) end diff --git a/lua/custom/chadrc.lua b/lua/custom/example_chadrc.lua similarity index 56% rename from lua/custom/chadrc.lua rename to lua/custom/example_chadrc.lua index cab9743..881dc5e 100644 --- a/lua/custom/chadrc.lua +++ b/lua/custom/example_chadrc.lua @@ -1,31 +1,23 @@ -- IMPORTANT NOTE : This is the user config, can be edited. Will be preserved if updated with internal updater +-- This file is for NvChad options & tools, custom settings are split between here and 'lua/custom/init.lua' local M = {} M.options, M.ui, M.mappings, M.plugins = {}, {}, {}, {} +-- NOTE: To use this, make a copy with `cp example_chadrc.lua chadrc.lua` + +-------------------------------------------------------------------- + -- To use this file, copy the strucutre of `core/default_config.lua`, --- then define your new var, an example of setting relative number: +-- examples of setting relative number & changing theme: -- M.options = { -- relativenumber = true, -- } - --- user custom mappings --- format: name = { "mode" , "keys" , "cmd" , "options"} - -- name: can be empty or something unique with repect to other custom mappings - -- { mode, key, cmd } or name = { mode, key, cmd } - -- mode: usage: mode or { mode1, mode2 }, multiple modes allowed, available modes => :h map-modes, - -- keys: multiple keys allowed, same synxtax as modes - -- cmd: for vim commands, must use ':' at start and add at the end if want to execute - -- options: see :h nvim_set_keymap() opts section -M.mappings.custom = { - -- clear_all = { - -- "n", - -- "cc", - -- "gg0vG$d", - -- }, -} +-- M.ui = { +-- theme = "nord" +-- } -- NvChad included plugin options & overrides M.plugins = { diff --git a/lua/custom/example_init.lua b/lua/custom/example_init.lua new file mode 100644 index 0000000..8b2aad4 --- /dev/null +++ b/lua/custom/example_init.lua @@ -0,0 +1,48 @@ +-- This is where you custom modules and plugins goes. +-- See the wiki for a guide on how to extend NvChad + +local hooks = require "core.hooks" + +-- NOTE: To use this, make a copy with `cp example_init.lua init.lua` + +-------------------------------------------------------------------- + +-- To modify packaged plugin configs, use the overrides functionality +-- if the override does not exist in the plugin config, make or request a PR, +-- or you can override the whole plugin config with 'chadrc' -> M.plugins.default_plugin_config_replace{} + -- this will run your config instead of the NvChad config for the given plugin + +-- hooks.override("lsp", "publish_diagnostics", function(current) +-- current.virtual_text = false; +-- return current; +-- end) + + + +-- To add new mappings, use the "setup_mappings" hook, +-- you can set one or many mappings +-- example below: + +-- hooks.add("setup_mappings", function(map) +-- map("n", "cc", "gg0vG$d", opt) -- example to delete the buffer +-- .... many more mappings .... +-- end) + + + +-- To add new plugins, use the "install_plugin" hook, +-- NOTE: we heavily suggest using Packer's lazy loading (with the 'event' field) + -- see: https://github.com/wbthomason/packer.nvim +-- examples below: + +-- hooks.add("install_plugins", function(use) +-- use { +-- "max397574/better-escape.nvim", +-- event = "InsertEnter", +-- } +-- end) + +-- alternatively, put this in a sub-folder like "lua/custom/plugins/mkdir" +-- then source it with + +-- require "custom.plugins.mkdir" diff --git a/lua/custom/init.lua b/lua/custom/init.lua deleted file mode 100644 index 5a80710..0000000 --- a/lua/custom/init.lua +++ /dev/null @@ -1,11 +0,0 @@ --- This is where you custom modules and plugins goes. --- See the wiki for a guide on how to extend NvChad - -local hooks = require "core.hooks" - --- For example, the hook below overrieds 'publish_diagnostics' in the 'lspconfig' file, --- --- hooks.override("lsp", "publish_diagnostics", function(current) --- current.virtual_text = false; --- return current; --- end)