mirror of
https://github.com/nix-community/nixvim.git
synced 2025-12-16 05:51: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
|
|
@ -260,18 +260,18 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
|
||||
The keys will be automatically translated to raw lua:
|
||||
```nix
|
||||
{
|
||||
"vim.diagnostic.severity.INFO".enabled = true;
|
||||
"vim.diagnostic.severity.WARN".enabled = true;
|
||||
}
|
||||
{
|
||||
"vim.diagnostic.severity.INFO".enabled = true;
|
||||
"vim.diagnostic.severity.WARN".enabled = true;
|
||||
}
|
||||
```
|
||||
will result in the following lua:
|
||||
```lua
|
||||
{
|
||||
-- Note the table keys are not string literals:
|
||||
[vim.diagnostic.severity.INFO] = { ['enabled'] = true },
|
||||
[vim.diagnostic.severity.WARN] = { ['enabled'] = true },
|
||||
}
|
||||
{
|
||||
-- Note the table keys are not string literals:
|
||||
[vim.diagnostic.severity.INFO] = { ['enabled'] = true },
|
||||
[vim.diagnostic.severity.WARN] = { ['enabled'] = true },
|
||||
}
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,34 +15,38 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
For example:
|
||||
|
||||
```nix
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.providers = {
|
||||
latex-symbols = {
|
||||
module = "blink-cmp-latex";
|
||||
name = "Latex";
|
||||
opts = {
|
||||
# set to true to insert the latex command instead of the symbol
|
||||
insert_command = false
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.providers = {
|
||||
latex-symbols = {
|
||||
module = "blink-cmp-latex";
|
||||
name = "Latex";
|
||||
opts = {
|
||||
# set to true to insert the latex command instead of the symbol
|
||||
insert_command = false
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
And then you can add it to blink-cmp's `sources.default` option:
|
||||
|
||||
```nix
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
"lsp"
|
||||
"path"
|
||||
"luasnip"
|
||||
"buffer"
|
||||
"latex-symbols"
|
||||
];
|
||||
};
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
"lsp"
|
||||
"path"
|
||||
"luasnip"
|
||||
"buffer"
|
||||
"latex-symbols"
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -15,33 +15,37 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
For example:
|
||||
|
||||
```nix
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.providers = {
|
||||
spell = {
|
||||
module = "blink-cmp-spell";
|
||||
name = "Spell";
|
||||
score_offset = 100;
|
||||
opts = {
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.providers = {
|
||||
spell = {
|
||||
module = "blink-cmp-spell";
|
||||
name = "Spell";
|
||||
score_offset = 100;
|
||||
opts = {
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
And then you can add it to blink-cmp's `sources.default` option:
|
||||
|
||||
```nix
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
"lsp"
|
||||
"path"
|
||||
"luasnip"
|
||||
"buffer"
|
||||
"spell"
|
||||
];
|
||||
};
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
"lsp"
|
||||
"path"
|
||||
"luasnip"
|
||||
"buffer"
|
||||
"spell"
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -19,43 +19,47 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
For example:
|
||||
|
||||
```nix
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.providers = {
|
||||
copilot = {
|
||||
async = true;
|
||||
module = "blink-copilot";
|
||||
name = "copilot";
|
||||
score_offset = 100;
|
||||
# Optional configurations
|
||||
opts = {
|
||||
max_completions = 3;
|
||||
max_attempts = 4;
|
||||
kind = "Copilot";
|
||||
debounce = 750;
|
||||
auto_refresh = {
|
||||
backward = true;
|
||||
forward = true;
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.providers = {
|
||||
copilot = {
|
||||
async = true;
|
||||
module = "blink-copilot";
|
||||
name = "copilot";
|
||||
score_offset = 100;
|
||||
# Optional configurations
|
||||
opts = {
|
||||
max_completions = 3;
|
||||
max_attempts = 4;
|
||||
kind = "Copilot";
|
||||
debounce = 750;
|
||||
auto_refresh = {
|
||||
backward = true;
|
||||
forward = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
And then you can add it to blink-cmp's `sources.default` option:
|
||||
|
||||
```nix
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
"lsp"
|
||||
"path"
|
||||
"luasnip"
|
||||
"buffer"
|
||||
"copilot"
|
||||
];
|
||||
};
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
"lsp"
|
||||
"path"
|
||||
"luasnip"
|
||||
"buffer"
|
||||
"copilot"
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -44,16 +44,18 @@ 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 = [
|
||||
"lsp"
|
||||
"path"
|
||||
"luasnip"
|
||||
"buffer"
|
||||
"ripgrep"
|
||||
];
|
||||
};
|
||||
{
|
||||
plugins.blink-cmp = {
|
||||
enable = true;
|
||||
settings.sources.default = [
|
||||
"lsp"
|
||||
"path"
|
||||
"luasnip"
|
||||
"buffer"
|
||||
"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;
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -302,12 +302,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
|
||||
For example,
|
||||
```nix
|
||||
[ {} { paths = ./path/to/snippets; } ]
|
||||
[ {} { paths = ./path/to/snippets; } ]
|
||||
```
|
||||
will generate the following lua:
|
||||
```lua
|
||||
require("luasnip.loaders.from_vscode").lazy_load({})
|
||||
require("luasnip.loaders.from_vscode").lazy_load({['paths'] = {'/nix/store/.../path/to/snippets'}})
|
||||
require("luasnip.loaders.from_vscode").lazy_load({})
|
||||
require("luasnip.loaders.from_vscode").lazy_load({['paths'] = {'/nix/store/.../path/to/snippets'}})
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 = "";
|
||||
}
|
||||
];
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -39,28 +39,28 @@ in
|
|||
|
||||
Default:
|
||||
```nix
|
||||
[
|
||||
{
|
||||
type = "files";
|
||||
header = [" MRU"];
|
||||
}
|
||||
{
|
||||
type = "dir";
|
||||
header = [{__raw = "' MRU' .. vim.loop.cwd()";}];
|
||||
}
|
||||
{
|
||||
type = "sessions";
|
||||
header = [" Sessions"];
|
||||
}
|
||||
{
|
||||
type = "bookmarks";
|
||||
header = [" Bookmarks"];
|
||||
}
|
||||
{
|
||||
type = "commands";
|
||||
header = [" Commands"];
|
||||
}
|
||||
]
|
||||
[
|
||||
{
|
||||
type = "files";
|
||||
header = [" MRU"];
|
||||
}
|
||||
{
|
||||
type = "dir";
|
||||
header = [{__raw = "' MRU' .. vim.loop.cwd()";}];
|
||||
}
|
||||
{
|
||||
type = "sessions";
|
||||
header = [" Sessions"];
|
||||
}
|
||||
{
|
||||
type = "bookmarks";
|
||||
header = [" Bookmarks"];
|
||||
}
|
||||
{
|
||||
type = "commands";
|
||||
header = [" Commands"];
|
||||
}
|
||||
]
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
|
@ -100,12 +100,12 @@ in
|
|||
|
||||
Example:
|
||||
```nix
|
||||
[
|
||||
":help reference"
|
||||
["Vim Reference" "h ref"]
|
||||
{h = "h ref";}
|
||||
{m = ["My magical function" "call Magic()"];}
|
||||
]
|
||||
[
|
||||
":help reference"
|
||||
["Vim Reference" "h ref"]
|
||||
{h = "h ref";}
|
||||
{m = ["My magical function" "call Magic()"];}
|
||||
]
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
@ -204,11 +204,11 @@ in
|
|||
|
||||
Example:
|
||||
```nix
|
||||
[
|
||||
"\.vimgolf"
|
||||
"^/tmp"
|
||||
"/project/.*/documentation"
|
||||
]
|
||||
[
|
||||
"\.vimgolf"
|
||||
"^/tmp"
|
||||
"/project/.*/documentation"
|
||||
]
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ in
|
|||
|
||||
Example:
|
||||
```nix
|
||||
["setlocal" "winheight"]
|
||||
["setlocal" "winheight"]
|
||||
```
|
||||
Internally this simply does:
|
||||
- `:global/setlocal/delete`
|
||||
|
|
@ -279,11 +279,11 @@ in
|
|||
|
||||
Example:
|
||||
```nix
|
||||
[
|
||||
"g:startify_session_savevars"
|
||||
"g:startify_session_savecmds"
|
||||
"g:random_plugin_use_feature"
|
||||
]
|
||||
[
|
||||
"g:startify_session_savevars"
|
||||
"g:startify_session_savecmds"
|
||||
"g:random_plugin_use_feature"
|
||||
]
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
@ -292,9 +292,9 @@ in
|
|||
|
||||
Example:
|
||||
```nix
|
||||
[
|
||||
"silent !pdfreader ~/latexproject/main.pdf &"
|
||||
]
|
||||
[
|
||||
"silent !pdfreader ~/latexproject/main.pdf &"
|
||||
]
|
||||
```
|
||||
'';
|
||||
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue