Skip to content

Commit

Permalink
Languages (java,kotlin,terraform): add treesitter options
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-zenner committed Oct 2, 2023
1 parent 60950c0 commit 582710f
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 5 deletions.
13 changes: 8 additions & 5 deletions modules/languages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ with lib; let
in
{
imports = [
./bash.nix
./clang.nix
./go.nix
./html.nix
./java.nix
./kotlin.nix
./markdown.nix
./nix.nix
./plantuml.nix
./python.nix
./rust.nix
./sql.nix
./terraform.nix
./tidal.nix
./ts.nix
./zig.nix
./markdown.nix
./plantuml.nix
./tidal.nix
./html.nix
./bash.nix
];

options.vim.languages = {
Expand Down
29 changes: 29 additions & 0 deletions modules/languages/java.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.languages.java;
in {
options.vim.languages.java = {
enable = mkEnableOption "Java language support";

treesitter = {
enable = mkOption {
description = "Enable Java treesitter";
type = types.bool;
default = config.vim.languages.enableTreesitter;
};
package = nvim.options.mkGrammarOption pkgs "java";
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
]);
}
29 changes: 29 additions & 0 deletions modules/languages/kotlin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.languages.kotlin;
in {
options.vim.languages.kotlin = {
enable = mkEnableOption "Kotlin language support";

treesitter = {
enable = mkOption {
description = "Enable kotlin treesitter";
type = types.bool;
default = config.vim.languages.enableTreesitter;
};
package = nvim.options.mkGrammarOption pkgs "kotlin";
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
]);
}
29 changes: 29 additions & 0 deletions modules/languages/terraform.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.languages.terraform;
in {
options.vim.languages.terraform = {
enable = mkEnableOption "Terraform language support";

treesitter = {
enable = mkOption {
description = "Enable terraform treesitter";
type = types.bool;
default = config.vim.languages.enableTreesitter;
};
package = nvim.options.mkGrammarOption pkgs "terraform";
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
]);
}

0 comments on commit 582710f

Please sign in to comment.