mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 16:39:00 +02:00
plugins/treesitter: Add injections to highlight lua in nixvim options (#344)
This commit is contained in:
parent
5a498edd14
commit
9c8bee9da6
2 changed files with 25 additions and 0 deletions
|
@ -91,6 +91,10 @@ in {
|
||||||
default = {};
|
default = {};
|
||||||
description = "This is the configuration for extra modules. It should not be used directly";
|
description = "This is the configuration for extra modules. It should not be used directly";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixvimInjections =
|
||||||
|
mkEnableOption
|
||||||
|
"nixvim specific injections, like lua highlighting in extraConfigLua";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -148,6 +152,20 @@ in {
|
||||||
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
|
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
extraFiles = mkIf cfg.nixvimInjections {
|
||||||
|
"queries/nix/injections.scm" = ''
|
||||||
|
;; extends
|
||||||
|
|
||||||
|
(binding
|
||||||
|
attrpath: (attrpath (identifier) @_path)
|
||||||
|
expression: [
|
||||||
|
(string_expression (string_fragment) @lua)
|
||||||
|
(indented_string_expression (string_fragment) @lua)
|
||||||
|
]
|
||||||
|
(#match? @_path "^extraConfigLua(Pre|Post)?$"))
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraPlugins = with pkgs;
|
extraPlugins = with pkgs;
|
||||||
if cfg.nixGrammars
|
if cfg.nixGrammars
|
||||||
then [(cfg.package.withPlugins (_: cfg.grammarPackages))]
|
then [(cfg.package.withPlugins (_: cfg.grammarPackages))]
|
||||||
|
|
|
@ -12,6 +12,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixvimInjections = {
|
||||||
|
plugins.treesitter = {
|
||||||
|
enable = true;
|
||||||
|
nixvimInjections = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# This needs a custom input
|
# This needs a custom input
|
||||||
# custom = {
|
# custom = {
|
||||||
# plugins.treesitter = {
|
# plugins.treesitter = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue