Skip to content

Commit

Permalink
readme: add "plugin settings" and "raw lua" sections
Browse files Browse the repository at this point in the history
  • Loading branch information
MattSturgeon committed Jun 3, 2024
1 parent a7cbb0e commit 0c2834c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,38 @@ as fast as possible.
Since everything is disabled by default, it will be as snappy as you want it to
be.

### Plugin settings
Most plugins have a `settings` option, which accepts _any_ nix attribute set
and translate it into a lua table. This is then passed to the plugin's `setup`
function. In practice this means if a plugin has a `settings` option, any plugin
option can be configured, even if we don't explicitly have a corresponding nix
option.

### Raw lua
If you just want to add additional lines of lua to your `init.lua`, you can use
`extraConfigLua`, `extraConfigLuaPre`, and `extraConfigLuaPost`.

If you want to assign lua code to an option that'd normally accept another type
(string, int, etc), you can use nixvim's "raw type", `{ __raw = "lua code"; }`.

<details>
<summary>Example</summary>

This nix code:
```nix
{
some_option.__raw = "function() print('hello, world!') end";
}
```
Will produce the following lua:
```lua
{
['some_option'] = function() print('hello, world!') end,
}
```

</details>

## Support/Questions
If you have any question, please use the [discussions page](https://github.com/nix-community/nixvim/discussions/categories/q-a)! Alternatively, join the Matrix channel at [#nixvim:matrix.org](https://matrix.to/#/#nixvim:matrix.org)!

Expand Down

0 comments on commit 0c2834c

Please sign in to comment.