mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-04-15 00:58:37 +00:00
Merge f084b74a56
into ed31499ad6
This commit is contained in:
commit
6c94cd3b39
6 changed files with 61 additions and 4 deletions
|
@ -17,6 +17,9 @@
|
||||||
# Build nil from source to get most recent
|
# Build nil from source to get most recent
|
||||||
# features as they are added.
|
# features as they are added.
|
||||||
nil = inputs'.nil.packages.default;
|
nil = inputs'.nil.packages.default;
|
||||||
|
nvf-queries = final.callPackage ./legacyPackages/nvf-queries.nix {
|
||||||
|
version = self.shortRev or self.dirtyShortRev or "dirty";
|
||||||
|
};
|
||||||
blink-cmp = let
|
blink-cmp = let
|
||||||
pin = self.pins.blink-cmp;
|
pin = self.pins.blink-cmp;
|
||||||
in
|
in
|
||||||
|
|
10
flake/legacyPackages/nvf-queries.nix
Normal file
10
flake/legacyPackages/nvf-queries.nix
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
vimUtils,
|
||||||
|
version,
|
||||||
|
}:
|
||||||
|
vimUtils.buildVimPlugin {
|
||||||
|
pname = "nvf-queries";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
src = ./nvf-queries;
|
||||||
|
}
|
34
flake/legacyPackages/nvf-queries/queries/nix/injections.scm
Normal file
34
flake/legacyPackages/nvf-queries/queries/nix/injections.scm
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
; extends
|
||||||
|
|
||||||
|
(binding
|
||||||
|
attrpath: (attrpath
|
||||||
|
(identifier) @_path)
|
||||||
|
expression: [
|
||||||
|
(string_expression
|
||||||
|
(string_fragment) @injection.content)
|
||||||
|
(indented_string_expression
|
||||||
|
(string_fragment) @injection.content)
|
||||||
|
]
|
||||||
|
(#set! injection.language "lua")
|
||||||
|
(#match? @_path "^luaConfig\(Pre\|Post\)$"))
|
||||||
|
|
||||||
|
(apply_expression
|
||||||
|
function: [
|
||||||
|
(variable_expression
|
||||||
|
name: (identifier) @funcName
|
||||||
|
(#eq? @funcName "mkLuaInline"))
|
||||||
|
;; matches lib.generators.mkLuaInline
|
||||||
|
(select_expression
|
||||||
|
expression: _ @lib
|
||||||
|
(#eq? @lib "lib")
|
||||||
|
(attrpath
|
||||||
|
attr: (identifier) @generators
|
||||||
|
attr: (identifier) @funcName))
|
||||||
|
]
|
||||||
|
argument: [
|
||||||
|
(string_expression
|
||||||
|
(string_fragment) @injection.content)
|
||||||
|
(indented_string_expression
|
||||||
|
(string_fragment) @injection.content)
|
||||||
|
]
|
||||||
|
(#set! injection.language "lua"))
|
|
@ -18,7 +18,7 @@
|
||||||
pluginType = nullOr (
|
pluginType = nullOr (
|
||||||
either
|
either
|
||||||
package
|
package
|
||||||
(enum (pluginInputNames ++ ["nvim-treesitter" "flutter-tools-patched" "vim-repeat"]))
|
(enum (pluginInputNames ++ ["nvim-treesitter" "flutter-tools-patched" "vim-repeat" "nvf-queries"]))
|
||||||
);
|
);
|
||||||
|
|
||||||
pluginsType = listOf pluginType;
|
pluginsType = listOf pluginType;
|
||||||
|
|
|
@ -140,6 +140,13 @@ in {
|
||||||
treesitter = {
|
treesitter = {
|
||||||
enable = mkEnableOption "Nix treesitter" // {default = config.vim.languages.enableTreesitter;};
|
enable = mkEnableOption "Nix treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
package = mkGrammarOption pkgs "nix";
|
package = mkGrammarOption pkgs "nix";
|
||||||
|
|
||||||
|
enableNvfQueries =
|
||||||
|
mkEnableOption ''
|
||||||
|
extra query files targetted at nvf configuration, e.g. injection rules
|
||||||
|
for mkLuaInline and some options.
|
||||||
|
''
|
||||||
|
// {default = true;};
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
|
@ -212,8 +219,11 @@ in {
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkIf cfg.treesitter.enable {
|
(mkIf cfg.treesitter.enable {
|
||||||
vim.treesitter.enable = true;
|
vim = {
|
||||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
treesitter.enable = true;
|
||||||
|
treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
startPlugins = mkIf cfg.treesitter.enableNvfQueries ["nvf-queries"];
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit (inputs.self.legacyPackages.${pkgs.stdenv.system}) blink-cmp;
|
inherit (inputs.self.legacyPackages.${pkgs.stdenv.system}) blink-cmp nvf-queries;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildConfigPlugins = plugins:
|
buildConfigPlugins = plugins:
|
||||||
|
|
Loading…
Add table
Reference in a new issue