Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom config call, post config, pre keymap/plugin setup #161

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down
6 changes: 6 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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' }, '<Space>', '<Nop>', { silent = true })
Expand Down