diff --git a/modules/plugins/ui/modes/config.nix b/modules/plugins/ui/modes-nvim/config.nix similarity index 55% rename from modules/plugins/ui/modes/config.nix rename to modules/plugins/ui/modes-nvim/config.nix index 2ea9602a..e233b088 100644 --- a/modules/plugins/ui/modes/config.nix +++ b/modules/plugins/ui/modes-nvim/config.nix @@ -10,12 +10,11 @@ cfg = config.vim.ui.modes-nvim; in { config = mkIf cfg.enable { - vim.startPlugins = [ - "modes-nvim" - ]; - - vim.pluginRC.modes-nvim = entryAnywhere '' - require('modes').setup(${toLuaObject cfg.setupOpts}) - ''; + vim = { + startPlugins = ["modes-nvim"]; + pluginRC.modes-nvim = entryAnywhere '' + require('modes').setup(${toLuaObject cfg.setupOpts}) + ''; + }; }; } diff --git a/modules/plugins/ui/modes/default.nix b/modules/plugins/ui/modes-nvim/default.nix similarity index 100% rename from modules/plugins/ui/modes/default.nix rename to modules/plugins/ui/modes-nvim/default.nix diff --git a/modules/plugins/ui/modes-nvim/modes-nvim.nix b/modules/plugins/ui/modes-nvim/modes-nvim.nix new file mode 100644 index 00000000..e42c939e --- /dev/null +++ b/modules/plugins/ui/modes-nvim/modes-nvim.nix @@ -0,0 +1,42 @@ +{lib, ...}: let + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) listOf bool either str float; + inherit (lib.nvim.types) mkPluginSetupOption luaInline; +in { + options.vim.ui.modes-nvim = { + enable = mkEnableOption "prismatic line decorations for Neovim [modes.nvim]"; + + setupOpts = mkPluginSetupOption "modes.nvim" { + set_cursorline = mkOption { + type = bool; + default = false; + description = '' + Whether to enable nable cursorline initially, and disable cursorline + for inactive windows or ignored filetypes. + ''; + }; + + line_opacity = { + visual = mkOption { + type = float; + default = 0.15; + example = 0.0; + description = "Opacity for cursorline and number background"; + }; + }; + + ignore = mkOption { + type = listOf (either str luaInline); + default = ["NvimTree" "TelescopePrompt" "!minifiles"]; + description = '' + Disable modes highlights for specified filetypes or enable with + prefix "!" if otherwise disabled. + + Can also be a function that returns a boolean value that disables modes + highlights when `true`. Use `lib.generators.mkLuaInline` if using a Lua + function. + ''; + }; + }; + }; +} diff --git a/modules/plugins/ui/modes/modes.nix b/modules/plugins/ui/modes/modes.nix deleted file mode 100644 index f73a298a..00000000 --- a/modules/plugins/ui/modes/modes.nix +++ /dev/null @@ -1,48 +0,0 @@ -{lib, ...}: let - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) bool str float; - inherit (lib.nvim.types) mkPluginSetupOption; -in { - options.vim.ui.modes-nvim = { - enable = mkEnableOption "modes.nvim's prismatic line decorations"; - - setupOpts = { - setCursorline = mkOption { - type = bool; - description = "Set a colored cursorline on current line"; - default = false; # looks ugly, disabled by default - }; - - line_opacity = { - visual = mkOption { - type = float; - description = "Set opacity for cursorline and number background"; - default = 0.0; - }; - }; - - colors = mkPluginSetupOption "modes.nvim" { - copy = mkOption { - type = str; - description = "The #RRGGBB color code for the visual mode highlights"; - default = "#f5c359"; - }; - delete = mkOption { - type = str; - description = "The #RRGGBB color code for the visual mode highlights"; - default = "#c75c6a"; - }; - insert = mkOption { - type = str; - description = "The #RRGGBB color code for the visual mode highlights"; - default = "#78ccc5"; - }; - visual = mkOption { - type = str; - description = "The #RRGGBB color code for the visual mode highlights"; - default = "#9745be"; - }; - }; - }; - }; -}