Browse Source

fix: Updated README.md+docs/modules.md to be consistent with new API.

my-config
connorgmeean 3 years ago
parent
commit
c5eefb2d2a
  1. 42
      README.md
  2. 7
      docs/modules.md
  3. 3
      init.lua

42
README.md

@ -33,6 +33,7 @@
* [Adding plugins](#adding-plugins)
* [Adding Keybinds](#adding-keybinds)
* [Adding autocommands](#adding-autocommands)
* [Adding commands](#adding-commands)
- [Overriding module defaults](#overriding-module-defaults)
* [FAQ](#faq)
* [Contributing](#contributing)
@ -94,7 +95,7 @@ return {
#### All modules
Doom-nvim currently has 39 `features` modules and 14 `langs` modules.
Doom-nvim currently has 35+ `features` modules and 20+ `langs` modules.
You can find a full list of modules (here)[./docs/modules.md#all-modules]
### Configuring and personalising: `config.lua`
@ -117,17 +118,17 @@ vim.opt.colorcolumn = 120 -- Regular vim options can also be set
##### Adding plugins
Additional packages can be imported with the `doom.use()` function.
Additional packages can be imported with the `doom.use_package()` function.
This is a wrapper around `packer.use()` and provides the same API. [DOCS](https://github.com/wbthomason/packer.nvim#quickstart)
```lua
-- config.lua
-- Simple config
doom.use('sainnhe/sonokai', 'EdenEast/nightfox.nvim')
doom.use_package('sainnhe/sonokai', 'EdenEast/nightfox.nvim')
-- Advanced config
doom.use({
doom.use_package({
'rafcamlet/nvim-luapad',
opt = true,
cmd = 'Luapad'
@ -136,13 +137,13 @@ doom.use({
##### Adding Keybinds
Additional keybinds can be defined with the `doom.bind()` function.
Additional keybinds can be defined with the `doom.use_keybind()` function.
This is a wrapper around a custom `nest.nvim` implementation and provides the same API. [DOCS](https://github.com/connorgmeehan/nest.nvim/tree/integrations-api#quickstart-guide)
```lua
-- config.lua
doom.bind({
doom.use_keybind({
{ '<leader>u', name = '+user', { -- Names this group in whichkey "+user"
{ 's', '<cmd>Telescope git_status<CR>', name = 'Git status' } -- Adds `<leader>us` keybind to trigger `Telescope git_status`
}},
@ -153,32 +154,53 @@ doom.bind({
##### Adding autocommands
Additional autocommands can be defined with the `doom.autocmd()` function.
Additional autocommands can be defined with the `doom.use_autocmd()` function.
```lua
-- config.lua
doom.autcmd({
doom.use_autocmd({
-- { "<event>", "<aupat>", "<command or function>"}
{ "FileType", "javascript", function() print('Yuck!') end}
})
```
##### Adding commands
Additional commands can be define with the `doom.use_cmd()` function.
```lua
-- config.lua
-- Bind single
doom.use_cmd( { 'Test', function() print('test') end } )
-- Bind multiple
doom.use_cmd({
{ 'Test1', function() print('test1') end },
{ 'Test2', function() print('test2') end },
})
```
#### Overriding module defaults
The settings and config for all modules are also exposed inside of the `doom` global object.
Here you can override the plugin git sources, pre-defined settings, keybinds or autocmds.
Make sure that the module that you want to configure/override is enabled in `modules.lua`
```lua
-- modules.lua
return {
features = {
'whichkey' -- Whichkey module is enabled
}
}
```
The same module with be avaliable in your `config.lua` in the `doom.modules.module_name` field.
The settings should have autocomplete from sumneko lua lsp.
```lua
-- config.lua
local whichkey = doom.modules.whichkey -- Get the whichkey module
@ -201,7 +223,7 @@ whichkey.binds = {
}
-- Add an additional autocommand
table.insert(whichkey.autcmds, { "event", "aupat", "cmd"})
table.insert(whichkey.autocmds, { "event", "aupat", "cmd"})
-- Replace all autocommands
whichkey.autocmds = {
{ "event", "aupat", "cmd"}

7
docs/modules.md

@ -76,6 +76,7 @@ Modules are grouped into 3 categories:
- [`dap`](../lua/doom/modules/features/dap) Debug adapter protocol for neovim
- [`explorer`](../lua/doom/modules/features/explorer) File explorer in the sidebar
- [`neorg`](../lua/doom/modules/features/neorg) Organise your life
- [`netrw`](../lua/doom/modules/features/netrw) Native file explorer in the sidebar
- [`telescope`](../lua/doom/modules/features/telescope) Search files, text, commands and more
- [`projects`](../lua/doom/modules/features/projects) Quick project switching
@ -93,11 +94,13 @@ Modules are grouped into 3 categories:
- [`css`](../lua/doom/modules/langs/css)
- [`vue`](../lua/doom/modules/langs/vue)
- [`tailwindcss`](../lua/doom/modules/langs/tailwindcss)
- [`svelte`](../lua/doom/modules/langs/svelte)
- [`rust`](../lua/doom/modules/langs/rust)
- [`cpp`](../lua/doom/modules/langs/cpp)
- [`c_sharp`](../lua/doom/modules/langs/c_sharp)
- [`kotlin`](../lua/doom/modules/langs/kotlin)
- [`java`](../lua/doom/modules/langs/java)
- [`go`](../lua/doom/modules/langs/go)
- [`config`](../lua/doom/modules/langs/config) Adds JSON, YAML, TOML support
- Missing a language? Submit a feature request issue.
@ -229,13 +232,13 @@ end
-- { "event", "aupat", "command or function" }
-- Example
module.autocmds = {
{ "FileType", "javascript", function() print("I'm in a javascript file now") end }
{ "BufWinEnter", "*.js", function() print("I'm in a javascript file now") end }
}
-- Similarly, autocmds can be conditional using a function
module.autocmds = function()
local autocmds = {}
if condition then
table.insert(autocmds, { "FileType", "javascript", function() print("I'm in a javascript file now") end })
table.insert(autocmds, { "BufWinEnter", "*.js", function() print("I'm in a javascript file now") end })
end
return autocmds
end

3
init.lua

@ -5,6 +5,3 @@ vim.opt.runtimepath:append(vim.fn.stdpath("data"))
-- Load the doom-nvim framework
require("doom.core")

Loading…
Cancel
Save