diff --git a/.github/typos.toml b/.github/typos.toml index ee33f4d5..935e6594 100644 --- a/.github/typos.toml +++ b/.github/typos.toml @@ -12,5 +12,6 @@ default.extend-ignore-words-re = [ "Emac", "tese", # for glsl shaders "Caue", + "bse", # ./modules/plugins/tabline/nvim-bufferline/nvim-bufferline.nix:20:78: "bse" should be "base". ] diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 3d1fef06..4574731c 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -322,6 +322,8 @@ - Fix {option}`vim.utility.nvim-biscuits.enable` by upgrading, to fix tree-sitter incompatibilities. +- Fix image.nvim processor configuration and cleanup module. + - Added [Selenen](https://github.com/kampfkarren/selene) for more diagnostics in `languages.lua`. diff --git a/modules/plugins/utility/images/image-nvim/config.nix b/modules/plugins/utility/images/image-nvim/config.nix index 7ab4ba72..70490c82 100644 --- a/modules/plugins/utility/images/image-nvim/config.nix +++ b/modules/plugins/utility/images/image-nvim/config.nix @@ -1,6 +1,7 @@ { config, lib, + pkgs, ... }: let inherit (lib.modules) mkIf; @@ -15,10 +16,14 @@ in { "image-nvim" ]; - luaPackages = [ + luaPackages = mkIf (cfg.setupOpts.processor == "magick_rock") [ "magick" ]; + extraPackages = mkIf (cfg.setupOpts.processor == "magick_cli") [ + pkgs.imagemagick + ]; + pluginRC.image-nvim = entryAnywhere '' require("image").setup( ${toLuaObject cfg.setupOpts} diff --git a/modules/plugins/utility/images/image-nvim/image-nvim.nix b/modules/plugins/utility/images/image-nvim/image-nvim.nix index f6998f55..af1d91cd 100644 --- a/modules/plugins/utility/images/image-nvim/image-nvim.nix +++ b/modules/plugins/utility/images/image-nvim/image-nvim.nix @@ -1,11 +1,14 @@ {lib, ...}: let inherit (lib.options) mkEnableOption mkOption; - inherit (lib.types) enum listOf str nullOr int; + inherit (lib.types) enum listOf str; inherit (lib.nvim.types) mkPluginSetupOption; in { options.vim.utility.images.image-nvim = { - enable = mkEnableOption "image support in Neovim [image.nvim]"; + enable = mkEnableOption '' + image support in Neovim [image.nvim]. + See for all configuration options. + ''; setupOpts = mkPluginSetupOption "image.nvim" { backend = mkOption { @@ -21,91 +24,15 @@ in { * `sixel` - uses the Sixel graphics protocol, widely supported by many terminals ''; }; - - integrations = { - markdown = { - enable = mkEnableOption " image.nvim in markdown files" // {default = true;}; - clearInInsertMode = mkEnableOption "clearing of images when entering insert mode"; - downloadRemoteImages = mkEnableOption "downloading remote images"; - onlyRenderAtCursor = mkEnableOption "only rendering images at cursor"; - filetypes = mkOption { - type = listOf str; - default = ["markdown" "vimwiki"]; - description = '' - Filetypes to enable image.nvim in. Markdown extensions - (i.e. quarto) can go here - ''; - }; - }; - - neorg = { - enable = mkEnableOption "image.nvim in Neorg files" // {default = true;}; - clearInInsertMode = mkEnableOption "clearing of images when entering insert mode"; - downloadRemoteImages = mkEnableOption "downloading remote images"; - onlyRenderAtCursor = mkEnableOption "only rendering images at cursor"; - filetypes = mkOption { - type = listOf str; - default = ["neorg"]; - description = '' - Filetypes to enable image.nvim in. - ''; - }; - }; - - maxWidth = mkOption { - type = nullOr int; - default = null; - description = '' - The maximum width of images to render. Images larger than - this will be scaled down to fit within this width. - ''; - }; + processor = mkOption { + type = enum ["magick_cli" "magick_rock"]; + default = "magick_rock"; + description = "The processor to use for image magick."; }; - maxHeight = mkOption { - type = nullOr int; - default = null; - description = '' - The maximum height of images to render. Images larger than - this will be scaled down to fit within this height. - ''; - }; - - maxWidthWindowPercentage = mkOption { - type = nullOr int; - default = null; - description = '' - The maximum width of images to render as a percentage of the - window width. Images larger than this will be scaled down to - fit within this width. - ''; - }; - - maxHeightWindowPercentage = mkOption { - type = nullOr int; - default = 50; - description = '' - The maximum height of images to render as a percentage of the - window height. Images larger than this will be scaled down to - fit within this height. - ''; - }; - - windowOverlapClear = { - enable = mkEnableOption "clearing of images when they overlap with the window"; - ftIgnore = mkOption { - type = listOf str; - default = ["cmp_menu" "cmp_docs" ""]; - description = '' - Filetypes to ignore window overlap clearing in. - ''; - }; - }; - - editorOnlyRenderWhenFocused = mkEnableOption "only rendering images when the editor is focused"; - hijackFilePatterns = mkOption { + hijack_file_patterns = mkOption { type = listOf str; - default = ["*.png" "*.jpg" "*.jpeg" "*.gif" "*.webp"]; + default = ["*.png" "*.jpg" "*.jpeg" "*.gif" "*.webp" "*.svg"]; description = '' File patterns to hijack for image.nvim. This is useful for filetypes that don't have a dedicated integration.