diff --git a/README.md b/README.md index 4cc00b1b817..ef9386b0f8d 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,18 @@ return function(use) end ``` +#### Example `config.lua` + +Customizing initialization behavior (beyond plugin configuration discussed above) can occur in two places -- before, and after, base configuration and plugin configuration. If you need to update something before kickstart loads, e.g. setting the `mapleader`, this can be done by adding a `config.lua` file (located at `$HOME/.config/nvim/lua/custom/config.lua`). + +```lua +return function() + -- set the leaders + vim.g.mapleader = ';' + vim.g.localmapleader = ' ' +end +``` + #### Example `defaults.lua` For further customizations, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`). diff --git a/init.lua b/init.lua index ac291dad17a..3952f1cb79f 100644 --- a/init.lua +++ b/init.lua @@ -132,6 +132,12 @@ vim.o.completeopt = 'menuone,noselect' vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' +-- Add custom config before keymaps and plugin configs +local has_config, config = pcall(require, 'custom.config') +if has_config then + config() +end + -- Keymaps for better default experience -- See `:help vim.keymap.set()` vim.keymap.set({ 'n', 'v' }, '', '', { silent = true })