nvf/modules/plugins/ui/smartcolumn/smartcolumn.nix

49 lines
1.6 KiB
Nix
Raw Permalink Normal View History

{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption literalExpression;
2024-03-10 21:00:14 +00:00
inherit (lib.types) nullOr int str attrsOf either listOf;
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
2024-03-10 21:00:14 +00:00
imports = let
renamedSetupOpt = oldPath: newPath:
mkRenamedOptionModule (["vim" "ui" "smartcolumn"] ++ oldPath) (["vim" "ui" "smartcolumn" "setupOpts"] ++ newPath);
in [
(renamedSetupOpt ["disabledFiletypes"] ["disabled_filetypes"])
(renamedSetupOpt ["showColumnAt"] ["colorcolumn"])
(renamedSetupOpt ["columnAt" "languages"] ["custom_colorcolumn"])
];
2023-04-05 13:58:56 +00:00
options.vim.ui.smartcolumn = {
enable = mkEnableOption "line length indicator";
2023-04-05 13:58:56 +00:00
2024-03-10 21:00:14 +00:00
setupOpts = mkPluginSetupOption "smartcolumn.nvim" {
colorcolumn = mkOption {
type = nullOr (either str (listOf str));
default = "120";
description = "The position at which the column will be displayed. Set to null to disable";
};
2023-04-05 13:58:56 +00:00
2024-03-10 21:00:14 +00:00
disabled_filetypes = mkOption {
type = listOf str;
default = ["help" "text" "markdown" "NvimTree" "alpha"];
description = "The filetypes smartcolumn will be disabled for.";
};
2023-04-11 10:57:34 +00:00
2024-03-10 21:00:14 +00:00
custom_colorcolumn = mkOption {
description = "The position at which smart column should be displayed for each individual buffer type";
2024-03-10 21:00:14 +00:00
type = attrsOf (either int (listOf int));
default = {};
2023-06-04 14:36:01 +00:00
example = literalExpression ''
2024-03-10 21:00:14 +00:00
vim.ui.smartcolumn.setupOpts.custom_colorcolumn = {
2023-06-04 14:36:01 +00:00
nix = 110;
ruby = 120;
java = 130;
go = [90 130];
};
'';
};
2023-04-05 13:58:56 +00:00
};
};
}