mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-27 03:47:37 +00:00
neovim/queries: init and add an example injection
This commit is contained in:
parent
d9ba7f0a9e
commit
6fe9ecd995
6 changed files with 181 additions and 4 deletions
|
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib) mkIf foldl' mapAttrsToList;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
|
@ -66,6 +67,40 @@ in {
|
|||
})
|
||||
''}
|
||||
'';
|
||||
|
||||
additionalRuntimePaths = mkIf (cfg.queries != []) [
|
||||
(let
|
||||
grouped =
|
||||
foldl'
|
||||
(
|
||||
acc: query:
|
||||
foldl'
|
||||
(
|
||||
inner: filetype: let
|
||||
path = "queries/${filetype}/${query.type}.scm";
|
||||
prev = inner.${path} or "";
|
||||
in
|
||||
inner
|
||||
// {
|
||||
${path} = prev + query.content;
|
||||
}
|
||||
)
|
||||
acc
|
||||
query.filetypes
|
||||
)
|
||||
{}
|
||||
cfg.queries;
|
||||
|
||||
files =
|
||||
mapAttrsToList
|
||||
(path: content: {
|
||||
name = path;
|
||||
path = pkgs.writeText path content;
|
||||
})
|
||||
grouped;
|
||||
in
|
||||
pkgs.linkFarm "treesitter-queries" files)
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue