fix(snippets): move snippets configuration to nvf module
This commit is contained in:
parent
d0714f8bff
commit
ad0d5ed0f8
4 changed files with 26 additions and 64 deletions
6
flake.lock
generated
6
flake.lock
generated
|
@ -474,11 +474,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1750133435,
|
"lastModified": 1750138565,
|
||||||
"narHash": "sha256-/LN8xFhCDHA3jOoYnhl2oCBAOAgUHis2kOVxlfA96p0=",
|
"narHash": "sha256-rewitXfshw4O6U9Yeasz4TjBbIUE3zdNMimc8TYtnSg=",
|
||||||
"owner": "rrvsh",
|
"owner": "rrvsh",
|
||||||
"repo": "nvf",
|
"repo": "nvf",
|
||||||
"rev": "50c881019c87b494b0ec6bb0a2f4b0e43af946c6",
|
"rev": "2c74994c5c5da1f363e67bc9ecad7e73c48d2208",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -81,12 +81,6 @@
|
||||||
sops-nix.nixosModules.sops
|
sops-nix.nixosModules.sops
|
||||||
stylix.nixosModules.stylix
|
stylix.nixosModules.stylix
|
||||||
stable-diffusion-webui-nix.nixosModules.default
|
stable-diffusion-webui-nix.nixosModules.default
|
||||||
{
|
|
||||||
nix.settings.substituters = [ "https://nvf.cachix.org" ];
|
|
||||||
nix.settings.trusted-public-keys = [
|
|
||||||
"nvf.cachix.org-1:GMQWiUhZ6ux9D5CvFFMwnc2nFrUHTeGaXRlVBXo+naI="
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
homes.modules = with inputs; [
|
homes.modules = with inputs; [
|
||||||
impermanence.homeManagerModules.impermanence
|
impermanence.homeManagerModules.impermanence
|
||||||
|
|
|
@ -4,5 +4,26 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
setupOpts.enable_autosnippets = true;
|
setupOpts.enable_autosnippets = true;
|
||||||
providers = with pkgs.vimPlugins; [ vim-snippets ];
|
providers = with pkgs.vimPlugins; [ vim-snippets ];
|
||||||
|
customSnippets.snipmate = {
|
||||||
|
all = [
|
||||||
|
{
|
||||||
|
trigger = "if";
|
||||||
|
body = "if $1 else $2";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
nix = [
|
||||||
|
{
|
||||||
|
trigger = "mkOption";
|
||||||
|
body = ''
|
||||||
|
mkOption {
|
||||||
|
type = $1;
|
||||||
|
default = $2;
|
||||||
|
description = $3;
|
||||||
|
example = $4;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,66 +1,13 @@
|
||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib) singleton replicate;
|
inherit (lib) singleton;
|
||||||
inherit (lib.strings)
|
|
||||||
concatMapStringsSep
|
|
||||||
removeSuffix
|
|
||||||
concatStrings
|
|
||||||
stringAsChars
|
|
||||||
;
|
|
||||||
inherit (lib.attrsets) mapAttrsToList;
|
|
||||||
inherit (pkgs) writeTextFile;
|
|
||||||
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);
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.sessionVariables.EDITOR = "nvim";
|
home.sessionVariables.EDITOR = "nvim";
|
||||||
persistDirs = singleton ".local/share/nvf";
|
persistDirs = singleton ".local/share/nvf";
|
||||||
programs.nvf.enable = true;
|
programs.nvf.enable = true;
|
||||||
programs.nvf.settings.vim = {
|
programs.nvf.settings.vim = {
|
||||||
startPlugins =
|
startPlugins = [ pkgs.pantheon.snippets ];
|
||||||
[ pkgs.pantheon.snippets ]
|
|
||||||
++ (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";
|
|
||||||
}
|
|
||||||
)
|
|
||||||
{
|
|
||||||
all = [
|
|
||||||
{
|
|
||||||
trigger = "if";
|
|
||||||
description = "";
|
|
||||||
body = "if $1 else $2";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
nix = [
|
|
||||||
{
|
|
||||||
trigger = "mkOption";
|
|
||||||
description = "";
|
|
||||||
body = ''
|
|
||||||
mkOption {
|
|
||||||
type = $1;
|
|
||||||
default = $2;
|
|
||||||
description = $3;
|
|
||||||
example = $4;
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
hideSearchHighlight = true;
|
hideSearchHighlight = true;
|
||||||
syntaxHighlighting = true;
|
syntaxHighlighting = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue