mirror of
https://github.com/nix-community/nixvim.git
synced 2025-12-16 14:01:10 +01:00
docs: format nix examples in options
This commit is contained in:
parent
d52007581e
commit
297e2e0b65
17 changed files with 293 additions and 265 deletions
|
|
@ -130,7 +130,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
for example, you could reuse some colors from the builtin colorschemes:
|
||||
|
||||
```nix
|
||||
{
|
||||
base03.__raw = "base16.colorschemes['catppuccin'].base06";
|
||||
}
|
||||
```
|
||||
|
||||
[plugin's source code]: https://github.com/RRethy/base16-nvim/blob/master/lua/colors/init.lua
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
For example:
|
||||
|
||||
```nix
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.providers = {
|
||||
|
|
@ -28,11 +29,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
And then you can add it to blink-cmp's `sources.default` option:
|
||||
|
||||
```nix
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
|
|
@ -43,6 +46,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
"latex-symbols"
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
For example:
|
||||
|
||||
```nix
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.providers = {
|
||||
|
|
@ -27,11 +28,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
And then you can add it to blink-cmp's `sources.default` option:
|
||||
|
||||
```nix
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
|
|
@ -42,6 +45,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
"spell"
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
For example:
|
||||
|
||||
```nix
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.providers = {
|
||||
|
|
@ -41,11 +42,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
And then you can add it to blink-cmp's `sources.default` option:
|
||||
|
||||
```nix
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
|
|
@ -56,6 +59,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
"copilot"
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
And then you can add it to blink-cmp's `sources.default` option:
|
||||
|
||||
```nix
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
|
|
@ -54,6 +55,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
"ripgrep"
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
Hop doesn’t set any keybindings; you will have to define them by yourself.
|
||||
If you want to create a key binding from within nixvim:
|
||||
```nix
|
||||
{
|
||||
keymaps = [
|
||||
{
|
||||
key = "f";
|
||||
|
|
@ -68,6 +69,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
options.remap = true;
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ lib.nixvim.plugins.mkVimPlugin {
|
|||
The `settings` option will not let you define the options starting with `sandwich#`.
|
||||
For those, you can directly use the `globals` option:
|
||||
```nix
|
||||
{
|
||||
globals."sandwich#magicchar#f#patterns" = [
|
||||
{
|
||||
header.__raw = "[[\<\%(\h\k*\.\)*\h\k*]]";
|
||||
|
|
@ -21,6 +22,7 @@ lib.nixvim.plugins.mkVimPlugin {
|
|||
footer = "";
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
If you'd like more control, you could instead specify which packages to install. For example:
|
||||
|
||||
```nix
|
||||
{
|
||||
plugins.treesitter = {
|
||||
enable = true;
|
||||
|
||||
|
|
@ -58,6 +59,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
yaml
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
```nix
|
||||
{
|
||||
plugins.treesitter = {
|
||||
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`.
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
|
||||
#### With auto-enabled sources
|
||||
```nix
|
||||
{
|
||||
plugins.cmp = {
|
||||
autoEnableSources = true;
|
||||
settings.sources = [
|
||||
|
|
@ -36,10 +37,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
{ name = "buffer"; }
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
#### Without auto-enabled sources
|
||||
```nix
|
||||
{
|
||||
plugins = {
|
||||
cmp = {
|
||||
autoEnableSources = false;
|
||||
|
|
@ -53,7 +56,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
cmp-path.enable = true;
|
||||
cmp-buffer.enable = true;
|
||||
};
|
||||
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ let
|
|||
if you don't want to see `buffer` source items while `nvim-lsp` source is available:
|
||||
|
||||
```nix
|
||||
{
|
||||
sources = [
|
||||
{
|
||||
name = "nvim_lsp";
|
||||
|
|
@ -51,6 +52,7 @@ let
|
|||
group_index = 2;
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@ in
|
|||
type = with types; listOf (maybeRaw str);
|
||||
pluginDefault = { };
|
||||
example = {
|
||||
|
||||
"<LANGUAGE1>" = [
|
||||
"<WORD1>"
|
||||
"<WORD2>"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue