Skip to content

Commit 0c2834c

Browse files
committed
readme: add "plugin settings" and "raw lua" sections
1 parent a7cbb0e commit 0c2834c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,38 @@ as fast as possible.
4646
Since everything is disabled by default, it will be as snappy as you want it to
4747
be.
4848

49+
### Plugin settings
50+
Most plugins have a `settings` option, which accepts _any_ nix attribute set
51+
and translate it into a lua table. This is then passed to the plugin's `setup`
52+
function. In practice this means if a plugin has a `settings` option, any plugin
53+
option can be configured, even if we don't explicitly have a corresponding nix
54+
option.
55+
56+
### Raw lua
57+
If you just want to add additional lines of lua to your `init.lua`, you can use
58+
`extraConfigLua`, `extraConfigLuaPre`, and `extraConfigLuaPost`.
59+
60+
If you want to assign lua code to an option that'd normally accept another type
61+
(string, int, etc), you can use nixvim's "raw type", `{ __raw = "lua code"; }`.
62+
63+
<details>
64+
<summary>Example</summary>
65+
66+
This nix code:
67+
```nix
68+
{
69+
some_option.__raw = "function() print('hello, world!') end";
70+
}
71+
```
72+
Will produce the following lua:
73+
```lua
74+
{
75+
['some_option'] = function() print('hello, world!') end,
76+
}
77+
```
78+
79+
</details>
80+
4981
## Support/Questions
5082
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)!
5183

0 commit comments

Comments
 (0)