feat(snippets): fucking finally get working snippets
This commit is contained in:
parent
81de39561a
commit
d0714f8bff
4 changed files with 63 additions and 12 deletions
11
flake.lock
generated
11
flake.lock
generated
|
@ -474,15 +474,16 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1749895904,
|
"lastModified": 1750133435,
|
||||||
"narHash": "sha256-D7ZLf2ApiHMLlS6Imu7yHaB4Nbf9Hi8a8/64xOt6qOo=",
|
"narHash": "sha256-/LN8xFhCDHA3jOoYnhl2oCBAOAgUHis2kOVxlfA96p0=",
|
||||||
"owner": "notashelf",
|
"owner": "rrvsh",
|
||||||
"repo": "nvf",
|
"repo": "nvf",
|
||||||
"rev": "77a32f0961edbeda82e80c1bcd465cad21004fc7",
|
"rev": "50c881019c87b494b0ec6bb0a2f4b0e43af946c6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "notashelf",
|
"owner": "rrvsh",
|
||||||
|
"ref": "luasnip-customsnippets-stg",
|
||||||
"repo": "nvf",
|
"repo": "nvf",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
nvf.inputs.nil.follows = "nil";
|
nvf.inputs.nil.follows = "nil";
|
||||||
nvf.inputs.nixpkgs.follows = "nixpkgs";
|
nvf.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
nvf.inputs.systems.follows = "systems";
|
nvf.inputs.systems.follows = "systems";
|
||||||
nvf.url = "github:notashelf/nvf";
|
nvf.url = "github:rrvsh/nvf/luasnip-customsnippets-stg";
|
||||||
python-flexseal.inputs.flake-utils.follows = "flake-utils";
|
python-flexseal.inputs.flake-utils.follows = "flake-utils";
|
||||||
python-flexseal.inputs.nixpkgs.follows = "nixpkgs";
|
python-flexseal.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
python-flexseal.url = "github:Janrupf/python-flexseal";
|
python-flexseal.url = "github:Janrupf/python-flexseal";
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
luasnip = {
|
luasnip = {
|
||||||
enable = true;
|
enable = true;
|
||||||
setupOpts.enable_autosnippets = true;
|
setupOpts.enable_autosnippets = true;
|
||||||
loaders = ''
|
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
require('luasnip.loaders.from_snipmate').lazy_load()
|
|
||||||
'';
|
|
||||||
providers = with pkgs.vimPlugins; [ vim-snippets ];
|
providers = with pkgs.vimPlugins; [ vim-snippets ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,67 @@
|
||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib) singleton;
|
inherit (lib) singleton replicate;
|
||||||
|
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 = [ pkgs.pantheon.snippets ];
|
startPlugins =
|
||||||
|
[ 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;
|
||||||
telescope.enable = true;
|
telescope.enable = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue