mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-06 05:32:21 +00:00
Compare commits
No commits in common. "18c17b7b8dbf6e0f10e3eb5f1fa5341a9175a3b1" and "f661c388ee624d0e5b84f26555e11ebba33b4137" have entirely different histories.
18c17b7b8d
...
f661c388ee
5 changed files with 13 additions and 111 deletions
|
|
@ -19,12 +19,13 @@ indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
tab_width = 2
|
tab_width = 2
|
||||||
|
|
||||||
[*.{diff,patch,lock}]
|
[*.{diff,patch}]
|
||||||
end_of_line = unset
|
end_of_line = unset
|
||||||
insert_final_newline = unset
|
insert_final_newline = unset
|
||||||
trim_trailing_whitespace = unset
|
trim_trailing_whitespace = unset
|
||||||
|
|
||||||
[npins/sources.json]
|
[*.lock]
|
||||||
indent_style = unset
|
|
||||||
indent_size = unset
|
indent_size = unset
|
||||||
trim_trailing_whitespace = unset
|
|
||||||
|
[npins/sources.json]
|
||||||
|
insert_final_newline = unset
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,6 @@
|
||||||
|
|
||||||
[rrvsh](https://github.com/rrvsh):
|
[rrvsh](https://github.com/rrvsh):
|
||||||
|
|
||||||
- Add custom snippet support to `vim.snippets.luasnip`
|
|
||||||
- Fix namespace of python-lsp-server by changing it to python3Packages
|
- Fix namespace of python-lsp-server by changing it to python3Packages
|
||||||
|
|
||||||
[Noah765](https://github.com/Noah765):
|
[Noah765](https://github.com/Noah765):
|
||||||
|
|
|
||||||
12
flake.lock
generated
12
flake.lock
generated
|
|
@ -58,11 +58,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1750047244,
|
"lastModified": 1749796250,
|
||||||
"narHash": "sha256-vluLARrk4485npdyHOj8XKr0yk6H22pNf+KVRNL+i/Y=",
|
"narHash": "sha256-oxvVAFUO9husnRk6XZcLFLjLWL9z0pW25Fk6kVKwt1c=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "nil",
|
"repo": "nil",
|
||||||
"rev": "870a4b1b5f12004832206703ac15aa85c42c247b",
|
"rev": "9e4cccb088440c20703d62db9de8d5ae06d4a449",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -73,11 +73,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1750215678,
|
"lastModified": 1749743618,
|
||||||
"narHash": "sha256-Rc/ytpamXRf6z8UA2SGa4aaWxUXRbX2MAWIu2C8M+ok=",
|
"narHash": "sha256-ibsz06u1jlWyH7YURnRhLQn38Tuc5zwknr00suFjvfA=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5395fb3ab3f97b9b7abca147249fa2e8ed27b192",
|
"rev": "8d6cdc7756817e0c4b24567271634a44bcf80752",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,11 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
|
|
||||||
inherit (lib.lists) replicate;
|
|
||||||
inherit
|
|
||||||
(lib.strings)
|
|
||||||
optionalString
|
|
||||||
removeSuffix
|
|
||||||
concatStrings
|
|
||||||
stringAsChars
|
|
||||||
concatMapStringsSep
|
|
||||||
;
|
|
||||||
inherit (lib.attrsets) mapAttrsToList;
|
|
||||||
inherit (pkgs) writeTextFile;
|
|
||||||
cfg = config.vim.snippets.luasnip;
|
cfg = config.vim.snippets.luasnip;
|
||||||
# LuaSnip freaks out if the indentation is wrong in snippets
|
|
||||||
indent = n: s: let
|
|
||||||
indentString = concatStrings (replicate n " ");
|
|
||||||
sep = "\n" + indentString;
|
|
||||||
in
|
|
||||||
indentString
|
|
||||||
+ stringAsChars (c:
|
|
||||||
if c == "\n"
|
|
||||||
then sep
|
|
||||||
else c) (removeSuffix "\n" s);
|
|
||||||
customSnipmateSnippetFiles =
|
|
||||||
mapAttrsToList (
|
|
||||||
name: value:
|
|
||||||
writeTextFile {
|
|
||||||
name = "${name}.snippets";
|
|
||||||
text =
|
|
||||||
concatMapStringsSep "\n" (x: ''
|
|
||||||
snippet ${x.trigger} ${x.description}
|
|
||||||
${indent 2 x.body}
|
|
||||||
'')
|
|
||||||
value;
|
|
||||||
destination = "/snippets/${name}.snippets";
|
|
||||||
}
|
|
||||||
)
|
|
||||||
cfg.customSnippets.snipmate;
|
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
|
|
@ -56,16 +19,11 @@ in {
|
||||||
|
|
||||||
after = cfg.loaders;
|
after = cfg.loaders;
|
||||||
};
|
};
|
||||||
startPlugins = cfg.providers ++ customSnipmateSnippetFiles;
|
startPlugins = cfg.providers;
|
||||||
autocomplete.nvim-cmp = mkIf config.vim.autocomplete.nvim-cmp.enable {
|
autocomplete.nvim-cmp = mkIf config.vim.autocomplete.nvim-cmp.enable {
|
||||||
sources = {luasnip = "[LuaSnip]";};
|
sources = {luasnip = "[LuaSnip]";};
|
||||||
sourcePlugins = ["cmp-luasnip"];
|
sourcePlugins = ["cmp-luasnip"];
|
||||||
};
|
};
|
||||||
snippets.luasnip.loaders = ''
|
|
||||||
${optionalString (
|
|
||||||
cfg.customSnippets.snipmate != {}
|
|
||||||
) "require('luasnip.loaders.from_snipmate').lazy_load()"}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression literalMD;
|
inherit (lib.options) mkEnableOption mkOption literalExpression literalMD;
|
||||||
inherit (lib.types) listOf lines submodule str attrsOf;
|
inherit (lib.types) listOf lines;
|
||||||
inherit (lib.nvim.types) pluginType mkPluginSetupOption;
|
inherit (lib.nvim.types) pluginType mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.snippets.luasnip = {
|
options.vim.snippets.luasnip = {
|
||||||
|
|
@ -36,61 +36,5 @@ in {
|
||||||
setupOpts = mkPluginSetupOption "LuaSnip" {
|
setupOpts = mkPluginSetupOption "LuaSnip" {
|
||||||
enable_autosnippets = mkEnableOption "autosnippets";
|
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