mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-19 13:30:17 +00:00
Merge pull request #1548 from snoweuph/feat/img
utillity/image-nvim: fix processor configuration and cleanup module
This commit is contained in:
commit
8530b43e14
4 changed files with 20 additions and 85 deletions
1
.github/typos.toml
vendored
1
.github/typos.toml
vendored
|
|
@ -12,5 +12,6 @@ default.extend-ignore-words-re = [
|
||||||
"Emac",
|
"Emac",
|
||||||
"tese", # for glsl shaders
|
"tese", # for glsl shaders
|
||||||
"Caue",
|
"Caue",
|
||||||
|
"bse", # ./modules/plugins/tabline/nvim-bufferline/nvim-bufferline.nix:20:78: "bse" should be "base".
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -322,6 +322,8 @@
|
||||||
- Fix {option}`vim.utility.nvim-biscuits.enable` by upgrading, to fix
|
- Fix {option}`vim.utility.nvim-biscuits.enable` by upgrading, to fix
|
||||||
tree-sitter incompatibilities.
|
tree-sitter incompatibilities.
|
||||||
|
|
||||||
|
- Fix image.nvim processor configuration and cleanup module.
|
||||||
|
|
||||||
- Added [Selenen](https://github.com/kampfkarren/selene) for more diagnostics in
|
- Added [Selenen](https://github.com/kampfkarren/selene) for more diagnostics in
|
||||||
`languages.lua`.
|
`languages.lua`.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
|
|
@ -15,10 +16,14 @@ in {
|
||||||
"image-nvim"
|
"image-nvim"
|
||||||
];
|
];
|
||||||
|
|
||||||
luaPackages = [
|
luaPackages = mkIf (cfg.setupOpts.processor == "magick_rock") [
|
||||||
"magick"
|
"magick"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
extraPackages = mkIf (cfg.setupOpts.processor == "magick_cli") [
|
||||||
|
pkgs.imagemagick
|
||||||
|
];
|
||||||
|
|
||||||
pluginRC.image-nvim = entryAnywhere ''
|
pluginRC.image-nvim = entryAnywhere ''
|
||||||
require("image").setup(
|
require("image").setup(
|
||||||
${toLuaObject cfg.setupOpts}
|
${toLuaObject cfg.setupOpts}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
|
||||||
inherit (lib.types) enum listOf str nullOr int;
|
inherit (lib.types) enum listOf str;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.utility.images.image-nvim = {
|
options.vim.utility.images.image-nvim = {
|
||||||
enable = mkEnableOption "image support in Neovim [image.nvim]";
|
enable = mkEnableOption ''
|
||||||
|
image support in Neovim [image.nvim].
|
||||||
|
See <https://github.com/3rd/image.nvim#default-configuration> for all configuration options.
|
||||||
|
'';
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "image.nvim" {
|
setupOpts = mkPluginSetupOption "image.nvim" {
|
||||||
backend = mkOption {
|
backend = mkOption {
|
||||||
|
|
@ -21,91 +24,15 @@ in {
|
||||||
* `sixel` - uses the Sixel graphics protocol, widely supported by many terminals
|
* `sixel` - uses the Sixel graphics protocol, widely supported by many terminals
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
processor = mkOption {
|
||||||
integrations = {
|
type = enum ["magick_cli" "magick_rock"];
|
||||||
markdown = {
|
default = "magick_rock";
|
||||||
enable = mkEnableOption " image.nvim in markdown files" // {default = true;};
|
description = "The processor to use for image magick.";
|
||||||
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.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
maxHeight = mkOption {
|
hijack_file_patterns = 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 {
|
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = ["*.png" "*.jpg" "*.jpeg" "*.gif" "*.webp"];
|
default = ["*.png" "*.jpg" "*.jpeg" "*.gif" "*.webp" "*.svg"];
|
||||||
description = ''
|
description = ''
|
||||||
File patterns to hijack for image.nvim. This is useful for
|
File patterns to hijack for image.nvim. This is useful for
|
||||||
filetypes that don't have a dedicated integration.
|
filetypes that don't have a dedicated integration.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue