mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
feat: use mkGrammarOption
This commit is contained in:
parent
84ecf8f3fd
commit
544792e0b9
13 changed files with 31 additions and 47 deletions
|
@ -115,6 +115,7 @@ inputs: let
|
||||||
vim.git = {
|
vim.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
gitsigns.enable = true;
|
gitsigns.enable = true;
|
||||||
|
gitsigns.codeActions = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
vim.minimap = {
|
vim.minimap = {
|
||||||
|
|
|
@ -5,5 +5,5 @@
|
||||||
in {
|
in {
|
||||||
inherit (typesDag) dagOf;
|
inherit (typesDag) dagOf;
|
||||||
inherit (typesPlugin) pluginsOpt;
|
inherit (typesPlugin) pluginsOpt;
|
||||||
inherit (typesLanguage) diagnostics;
|
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,9 @@ in {
|
||||||
type = with types; listOf (either (enum (attrNames diagnostics)) (submodule diagnosticSubmodule));
|
type = with types; listOf (either (enum (attrNames diagnostics)) (submodule diagnosticSubmodule));
|
||||||
default = defaultDiagnostics;
|
default = defaultDiagnostics;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkGrammarOption = pkgs: grammar:
|
||||||
|
mkPackageOption pkgs ["${grammar} treesitter"] {
|
||||||
|
default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,16 +41,8 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = config.vim.languages.enableTreesitter;
|
default = config.vim.languages.enableTreesitter;
|
||||||
};
|
};
|
||||||
cPackage = mkOption {
|
cPackage = nvim.types.mkGrammarOption pkgs "c";
|
||||||
description = "C treesitter grammar to use";
|
cppPackage = nvim.types.mkGrammarOption pkgs "cpp";
|
||||||
type = types.package;
|
|
||||||
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.c;
|
|
||||||
};
|
|
||||||
cppPackage = mkOption {
|
|
||||||
description = "C++ treesitter grammar to use";
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.cpp;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
|
|
|
@ -8,7 +8,7 @@ with lib; let
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./markdown
|
./markdown
|
||||||
./tidal
|
./tidal
|
||||||
|
|
||||||
./clang.nix
|
./clang.nix
|
||||||
|
|
|
@ -31,11 +31,7 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = config.vim.languages.enableTreesitter;
|
default = config.vim.languages.enableTreesitter;
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = nvim.types.mkGrammarOption pkgs "go";
|
||||||
description = "Go treesitter grammar to use";
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.go;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
|
|
|
@ -9,6 +9,11 @@ with builtins; let
|
||||||
cfg = config.vim.languages.markdown;
|
cfg = config.vim.languages.markdown;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
(mkIf cfg.glow.enable {
|
(mkIf cfg.glow.enable {
|
||||||
vim.startPlugins = ["glow-nvim"];
|
vim.startPlugins = ["glow-nvim"];
|
||||||
|
|
||||||
|
|
|
@ -16,5 +16,14 @@ in {
|
||||||
default = true;
|
default = true;
|
||||||
description = "Enable markdown preview in neovim with glow";
|
description = "Enable markdown preview in neovim with glow";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkOption {
|
||||||
|
description = "Enable Markdown treesitter";
|
||||||
|
type = types.bool;
|
||||||
|
default = config.vim.languages.enableTreesitter;
|
||||||
|
};
|
||||||
|
package = nvim.types.mkGrammarOption pkgs "markdown";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,11 +92,7 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = config.vim.languages.enableTreesitter;
|
default = config.vim.languages.enableTreesitter;
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = nvim.types.mkGrammarOption pkgs "nix";
|
||||||
description = "Nix treesitter grammar to use";
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.nix;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
|
|
|
@ -64,11 +64,7 @@ in {
|
||||||
type = with types; enum (attrNames servers);
|
type = with types; enum (attrNames servers);
|
||||||
default = defaultServer;
|
default = defaultServer;
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = nvim.types.mkGrammarOption pkgs "python";
|
||||||
description = "Python LSP server package";
|
|
||||||
type = types.package;
|
|
||||||
default = servers.${cfg.lsp.server}.package;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
format = {
|
format = {
|
||||||
|
|
|
@ -17,11 +17,7 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = config.vim.languages.enableTreesitter;
|
default = config.vim.languages.enableTreesitter;
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = nvim.types.mkGrammarOption pkgs "rust";
|
||||||
description = "Rust treesitter grammar to use";
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.rust;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
crates = {
|
crates = {
|
||||||
|
|
|
@ -63,16 +63,8 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = config.vim.languages.enableTreesitter;
|
default = config.vim.languages.enableTreesitter;
|
||||||
};
|
};
|
||||||
tsPackage = mkOption {
|
tsPackage = nvim.types.mkGrammarOption pkgs "tsx";
|
||||||
description = "Typescript treesitter grammar to use";
|
jsPackage = nvim.types.mkGrammarOption pkgs "javascript";
|
||||||
type = types.package;
|
|
||||||
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.tsx;
|
|
||||||
};
|
|
||||||
jsPackage = mkOption {
|
|
||||||
description = "Javascript treesitter grammar to use";
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.javascript;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
|
|
|
@ -17,11 +17,7 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = config.vim.languages.enableTreesitter;
|
default = config.vim.languages.enableTreesitter;
|
||||||
};
|
};
|
||||||
package = mkOption {
|
package = nvim.types.mkGrammarOption pkgs "zig";
|
||||||
description = "Zig treesitter grammar to use";
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.zig;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
lsp = {
|
lsp = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
|
Loading…
Reference in a new issue