mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-04-13 16:18:36 +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
|
||||
# features as they are added.
|
||||
nil = inputs'.nil.packages.default;
|
||||
nvf-queries = final.callPackage ./legacyPackages/nvf-queries.nix {
|
||||
version = self.shortRev or self.dirtyShortRev or "dirty";
|
||||
};
|
||||
blink-cmp = let
|
||||
pin = self.pins.blink-cmp;
|
||||
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 (
|
||||
either
|
||||
package
|
||||
(enum (pluginInputNames ++ ["nvim-treesitter" "flutter-tools-patched" "vim-repeat"]))
|
||||
(enum (pluginInputNames ++ ["nvim-treesitter" "flutter-tools-patched" "vim-repeat" "nvf-queries"]))
|
||||
);
|
||||
|
||||
pluginsType = listOf pluginType;
|
||||
|
|
|
@ -140,6 +140,13 @@ in {
|
|||
treesitter = {
|
||||
enable = mkEnableOption "Nix treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
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 = {
|
||||
|
@ -212,8 +219,11 @@ in {
|
|||
}
|
||||
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
vim = {
|
||||
treesitter.enable = true;
|
||||
treesitter.grammars = [cfg.treesitter.package];
|
||||
startPlugins = mkIf cfg.treesitter.enableNvfQueries ["nvf-queries"];
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
doCheck = false;
|
||||
};
|
||||
|
||||
inherit (inputs.self.legacyPackages.${pkgs.stdenv.system}) blink-cmp;
|
||||
inherit (inputs.self.legacyPackages.${pkgs.stdenv.system}) blink-cmp nvf-queries;
|
||||
};
|
||||
|
||||
buildConfigPlugins = plugins:
|
||||
|
|
Loading…
Add table
Reference in a new issue