feat: move html into languages

This commit is contained in:
NotAShelf 2023-04-18 01:05:18 +03:00
parent 1829e321b5
commit 7355debede
No known key found for this signature in database
GPG Key ID: F0D14CCB5ED5AA22
6 changed files with 51 additions and 9 deletions

View File

@ -36,6 +36,7 @@ inputs: let
enableExtraDiagnostics = true; enableExtraDiagnostics = true;
nix.enable = true; nix.enable = true;
html.enable = isMaximal;
clang.enable = isMaximal; clang.enable = isMaximal;
sql.enable = isMaximal; sql.enable = isMaximal;
rust = { rust = {

View File

@ -1,4 +1,8 @@
{inputs, ...}: let {
inputs,
pkgs,
...
}: let
inherit (import ../extra.nix inputs) neovimConfiguration mainConfig; inherit (import ../extra.nix inputs) neovimConfiguration mainConfig;
buildPkg = pkgs: modules: buildPkg = pkgs: modules:
@ -14,5 +18,6 @@ in {
neovim-nix = buildPkg prev [nixConfig]; neovim-nix = buildPkg prev [nixConfig];
neovim-maximal = buildPkg prev [maximalConfig]; neovim-maximal = buildPkg prev [maximalConfig];
neovim-tidal = buildPkg prev [tidalConfig]; neovim-tidal = buildPkg prev [tidalConfig];
devPkg = buildPkg pkgs [nixConfig {config.vim.languages.html.enable = pkgs.lib.mkForce true;}];
}; };
} }

View File

@ -19,6 +19,7 @@ in {
./sql.nix ./sql.nix
./ts.nix ./ts.nix
./zig.nix ./zig.nix
./html.nix
]; ];
options.vim.languages = { options.vim.languages = {

View File

@ -0,0 +1,42 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.languages.html;
in {
options.vim.languages.html = {
enable = mkEnableOption "HTML language support";
treesitter = {
enable = mkOption {
description = "Enable HTML treesitter";
type = types.bool;
default = config.vim.languages.enableTreesitter;
};
package = nvim.types.mkGrammarOption pkgs "html";
autotagHtml = mkOption {
description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)";
type = types.bool;
default = true;
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
vim.startPlugins = optional cfg.treesitter.autotagHtml "nvim-ts-autotag";
vim.luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (nvim.dag.entryAnywhere ''
require('nvim-ts-autotag').setup()
'');
})
]);
}

View File

@ -1,4 +1,4 @@
{...}: { _: {
imports = [ imports = [
# nvim lsp support # nvim lsp support
./config.nix ./config.nix

View File

@ -12,7 +12,6 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.startPlugins = vim.startPlugins =
["nvim-treesitter"] ["nvim-treesitter"]
++ optional cfg.autotagHtml "nvim-ts-autotag"
++ optional usingNvimCmp "cmp-treesitter"; ++ optional usingNvimCmp "cmp-treesitter";
vim.autocomplete.sources = ["treesitter"]; vim.autocomplete.sources = ["treesitter"];
@ -43,12 +42,6 @@ in {
node_decremental = "grm", node_decremental = "grm",
}, },
}, },
${optionalString cfg.autotagHtml ''
autotag = {
enable = true,
},
''}
} }
''; '';
}; };