mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-12 13:13:28 +00:00
feat(snippets/luasnip): allow custom snippets
This commit is contained in:
parent
787678dd73
commit
8c7fdc0f5d
3 changed files with 101 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption literalExpression literalMD;
|
||||
inherit (lib.types) listOf lines;
|
||||
inherit (lib.types) listOf lines submodule str attrsOf;
|
||||
inherit (lib.nvim.types) pluginType mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.snippets.luasnip = {
|
||||
|
@ -36,5 +36,61 @@ in {
|
|||
setupOpts = mkPluginSetupOption "LuaSnip" {
|
||||
enable_autosnippets = mkEnableOption "autosnippets";
|
||||
};
|
||||
|
||||
customSnippets.snipmate = mkOption {
|
||||
type = attrsOf (
|
||||
listOf (submodule {
|
||||
options = {
|
||||
trigger = mkOption {
|
||||
type = str;
|
||||
description = ''
|
||||
The trigger used to activate this snippet.
|
||||
'';
|
||||
};
|
||||
description = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
description = ''
|
||||
The description shown for this snippet.
|
||||
'';
|
||||
};
|
||||
body = mkOption {
|
||||
type = str;
|
||||
description = ''
|
||||
[LuaSnip Documentation]: https://github.com/L3MON4D3/LuaSnip#add-snippets
|
||||
The body of the snippet in SnipMate format (see [LuaSnip Documentation]).
|
||||
'';
|
||||
};
|
||||
};
|
||||
})
|
||||
);
|
||||
default = {};
|
||||
example = ''
|
||||
{
|
||||
all = [
|
||||
{
|
||||
trigger = "if";
|
||||
body = "if $1 else $2";
|
||||
}
|
||||
];
|
||||
nix = [
|
||||
{
|
||||
trigger = "mkOption";
|
||||
body = '''
|
||||
mkOption {
|
||||
type = $1;
|
||||
default = $2;
|
||||
description = $3;
|
||||
example = $4;
|
||||
}
|
||||
''';
|
||||
}
|
||||
];
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
A list containing custom snippets in the SnipMate format to be loaded by LuaSnip.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue