1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-12-17 06:21:13 +01:00

docs: format nix examples in options

This commit is contained in:
Zexin Yuan 2025-12-12 19:26:32 +08:00 committed by Gaétan Lepage
parent d52007581e
commit 297e2e0b65
17 changed files with 293 additions and 265 deletions

View file

@ -130,7 +130,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
for example, you could reuse some colors from the builtin colorschemes: for example, you could reuse some colors from the builtin colorschemes:
```nix ```nix
{
base03.__raw = "base16.colorschemes['catppuccin'].base06"; base03.__raw = "base16.colorschemes['catppuccin'].base06";
}
``` ```
[plugin's source code]: https://github.com/RRethy/base16-nvim/blob/master/lua/colors/init.lua [plugin's source code]: https://github.com/RRethy/base16-nvim/blob/master/lua/colors/init.lua

View file

@ -15,6 +15,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
For example: For example:
```nix ```nix
{
plugins.blink-cmp = { plugins.blink-cmp = {
enable = true; enable = true;
settings.sources.providers = { settings.sources.providers = {
@ -28,11 +29,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
}; };
}; };
}
``` ```
And then you can add it to blink-cmp's `sources.default` option: And then you can add it to blink-cmp's `sources.default` option:
```nix ```nix
{
plugins.blink-cmp = { plugins.blink-cmp = {
enable = true; enable = true;
settings.sources.default = [ settings.sources.default = [
@ -43,6 +46,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
"latex-symbols" "latex-symbols"
]; ];
}; };
}
``` ```
''; '';

View file

@ -15,6 +15,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
For example: For example:
```nix ```nix
{
plugins.blink-cmp = { plugins.blink-cmp = {
enable = true; enable = true;
settings.sources.providers = { settings.sources.providers = {
@ -27,11 +28,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
}; };
}; };
}
``` ```
And then you can add it to blink-cmp's `sources.default` option: And then you can add it to blink-cmp's `sources.default` option:
```nix ```nix
{
plugins.blink-cmp = { plugins.blink-cmp = {
enable = true; enable = true;
settings.sources.default = [ settings.sources.default = [
@ -42,6 +45,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
"spell" "spell"
]; ];
}; };
}
``` ```
''; '';

View file

@ -19,6 +19,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
For example: For example:
```nix ```nix
{
plugins.blink-cmp = { plugins.blink-cmp = {
enable = true; enable = true;
settings.sources.providers = { settings.sources.providers = {
@ -41,11 +42,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
}; };
}; };
}
``` ```
And then you can add it to blink-cmp's `sources.default` option: And then you can add it to blink-cmp's `sources.default` option:
```nix ```nix
{
plugins.blink-cmp = { plugins.blink-cmp = {
enable = true; enable = true;
settings.sources.default = [ settings.sources.default = [
@ -56,6 +59,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
"copilot" "copilot"
]; ];
}; };
}
``` ```
''; '';

View file

@ -44,6 +44,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
And then you can add it to blink-cmp's `sources.default` option: And then you can add it to blink-cmp's `sources.default` option:
```nix ```nix
{
plugins.blink-cmp = { plugins.blink-cmp = {
enable = true; enable = true;
settings.sources.default = [ settings.sources.default = [
@ -54,6 +55,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
"ripgrep" "ripgrep"
]; ];
}; };
}
``` ```
''; '';

View file

@ -16,6 +16,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
Hop doesnt set any keybindings; you will have to define them by yourself. Hop doesnt set any keybindings; you will have to define them by yourself.
If you want to create a key binding from within nixvim: If you want to create a key binding from within nixvim:
```nix ```nix
{
keymaps = [ keymaps = [
{ {
key = "f"; key = "f";
@ -68,6 +69,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
options.remap = true; options.remap = true;
} }
]; ];
}
``` ```
''; '';

View file

@ -13,6 +13,7 @@ lib.nixvim.plugins.mkVimPlugin {
The `settings` option will not let you define the options starting with `sandwich#`. The `settings` option will not let you define the options starting with `sandwich#`.
For those, you can directly use the `globals` option: For those, you can directly use the `globals` option:
```nix ```nix
{
globals."sandwich#magicchar#f#patterns" = [ globals."sandwich#magicchar#f#patterns" = [
{ {
header.__raw = "[[\<\%(\h\k*\.\)*\h\k*]]"; header.__raw = "[[\<\%(\h\k*\.\)*\h\k*]]";
@ -21,6 +22,7 @@ lib.nixvim.plugins.mkVimPlugin {
footer = ""; footer = "";
} }
]; ];
}
``` ```
''; '';

View file

@ -40,6 +40,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
If you'd like more control, you could instead specify which packages to install. For example: If you'd like more control, you could instead specify which packages to install. For example:
```nix ```nix
{
plugins.treesitter = { plugins.treesitter = {
enable = true; enable = true;
@ -58,6 +59,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
yaml yaml
]; ];
}; };
}
``` ```
### Installing tree-sitter grammars from nvim-treesitter ### Installing tree-sitter grammars from nvim-treesitter
@ -69,6 +71,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
or use the `plugins.treesitter.settings.ensure_installed` option to specify grammars you want the plugin to fetch and install. or use the `plugins.treesitter.settings.ensure_installed` option to specify grammars you want the plugin to fetch and install.
```nix ```nix
{
plugins.treesitter = { plugins.treesitter = {
enable = true; enable = true;
@ -84,6 +87,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
]; ];
}; };
}; };
}
``` ```
NOTE: You can combine the functionality of `plugins.treesitter.nixGrammars` and `plugins.treesitter.settings.ensure_installed`. NOTE: You can combine the functionality of `plugins.treesitter.nixGrammars` and `plugins.treesitter.settings.ensure_installed`.

View file

@ -28,6 +28,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
#### With auto-enabled sources #### With auto-enabled sources
```nix ```nix
{
plugins.cmp = { plugins.cmp = {
autoEnableSources = true; autoEnableSources = true;
settings.sources = [ settings.sources = [
@ -36,10 +37,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
{ name = "buffer"; } { name = "buffer"; }
]; ];
}; };
}
``` ```
#### Without auto-enabled sources #### Without auto-enabled sources
```nix ```nix
{
plugins = { plugins = {
cmp = { cmp = {
autoEnableSources = false; autoEnableSources = false;
@ -53,7 +56,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
cmp-path.enable = true; cmp-path.enable = true;
cmp-buffer.enable = true; cmp-buffer.enable = true;
}; };
}
``` ```
''; '';

View file

@ -41,6 +41,7 @@ let
if you don't want to see `buffer` source items while `nvim-lsp` source is available: if you don't want to see `buffer` source items while `nvim-lsp` source is available:
```nix ```nix
{
sources = [ sources = [
{ {
name = "nvim_lsp"; name = "nvim_lsp";
@ -51,6 +52,7 @@ let
group_index = 2; group_index = 2;
} }
]; ];
}
``` ```
''; '';

View file

@ -108,7 +108,6 @@ in
type = with types; listOf (maybeRaw str); type = with types; listOf (maybeRaw str);
pluginDefault = { }; pluginDefault = { };
example = { example = {
"<LANGUAGE1>" = [ "<LANGUAGE1>" = [
"<WORD1>" "<WORD1>"
"<WORD2>" "<WORD2>"