feat: improved smartcolumn freeform

This commit is contained in:
NotAShelf 2023-06-04 17:36:01 +03:00
commit 86fec8646d
No known key found for this signature in database
GPG key ID: F0D14CCB5ED5AA22
4 changed files with 32 additions and 15 deletions

View file

@ -15,11 +15,11 @@ in {
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",
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

@ -17,13 +17,21 @@ with builtins; {
};
columnAt = {
# TODO: the current implementation only allows for options such as { ruby = "120", java = "120" }
# whereas the lua config would allow { ruby = "120", java = { "180", "200"} }, this needs to be fixed in the custom lib
languages = lib.mkOption {
description = "The position at which smart column should be displayed for each individual buffer type";
type = lib.types.submodule {
freeformType = with lib.types; attrsOf int;
freeformType = with lib.types; attrsOf (either int (listOf int));
};
example = lib.literalExpression ''
vim.ui.smartcolumn.columnAt.languages = {
nix = 110;
ruby = 120;
java = 130;
go = [90 130];
};
'';
};
};
};