neovim-flake/modules/plugins/ui/smartcolumn/smartcolumn.nix

49 lines
1.6 KiB
Nix
Raw Normal View History

{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) nullOr str attrsOf either listOf;
2024-03-10 22:00:14 +01:00
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
2024-03-10 22:00:14 +01: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 15:58:56 +02:00
options.vim.ui.smartcolumn = {
enable = mkEnableOption "line length indicator";
2023-04-05 15:58:56 +02:00
2024-03-10 22:00:14 +01: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 15:58:56 +02:00
2024-03-10 22:00:14 +01:00
disabled_filetypes = mkOption {
type = listOf str;
default = ["help" "text" "markdown" "NvimTree" "alpha"];
description = "The filetypes smartcolumn will be disabled for.";
};
2023-04-11 12:57:34 +02:00
2024-03-10 22:00:14 +01:00
custom_colorcolumn = mkOption {
description = "The position at which smart column should be displayed for each individual buffer type";
type = attrsOf (either str (listOf str));
2024-03-10 22:00:14 +01:00
default = {};
2023-06-04 16:36:01 +02:00
example = literalExpression ''
2024-03-10 22:00:14 +01:00
vim.ui.smartcolumn.setupOpts.custom_colorcolumn = {
nix = "110";
ruby = "120";
java = "130";
go = ["90" "130"];
2023-06-04 16:36:01 +02:00
};
'';
};
2023-04-05 15:58:56 +02:00
};
};
}