modules: start breaking down core modules; simplify tree structure

This commit is contained in:
raf 2024-02-17 04:02:15 +03:00
commit 370913e827
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
242 changed files with 178 additions and 124 deletions

View file

@ -0,0 +1,26 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf nvim concatStringsSep;
cfg = config.vim.ui.smartcolumn;
in {
config = mkIf cfg.enable {
vim.startPlugins = [
"smartcolumn"
];
vim.luaConfigRC.smartcolumn = nvim.dag.entryAnywhere ''
require("smartcolumn").setup({
colorcolumn = "${toString cfg.showColumnAt}",
-- { "help", "text", "markdown", "NvimTree", "alpha"},
disabled_filetypes = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.disabledFiletypes)} },
custom_colorcolumn = ${nvim.lua.attrsetToLuaTable cfg.columnAt.languages},
scope = "file",
})
'';
};
}

View file

@ -0,0 +1,6 @@
_: {
imports = [
./smartcolumn.nix
./config.nix
];
}

View file

@ -0,0 +1,37 @@
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types literalExpression;
in {
options.vim.ui.smartcolumn = {
enable = mkEnableOption "line length indicator";
showColumnAt = mkOption {
type = types.nullOr types.int;
default = 120;
description = "The position at which the column will be displayed. Set to null to disable";
};
disabledFiletypes = mkOption {
type = types.listOf types.str;
default = ["help" "text" "markdown" "NvimTree" "alpha"];
description = "The filetypes smartcolumn will be disabled for.";
};
columnAt = {
languages = mkOption {
description = "The position at which smart column should be displayed for each individual buffer type";
type = types.submodule {
freeformType = with types; attrsOf (either int (listOf int));
};
example = literalExpression ''
vim.ui.smartcolumn.columnAt.languages = {
nix = 110;
ruby = 120;
java = 130;
go = [90 130];
};
'';
};
};
};
}