mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-19 05:24:22 +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",
|
||||
"tese", # for glsl shaders
|
||||
"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
|
||||
tree-sitter incompatibilities.
|
||||
|
||||
- Fix image.nvim processor configuration and cleanup module.
|
||||
|
||||
- Added [Selenen](https://github.com/kampfkarren/selene) for more diagnostics in
|
||||
`languages.lua`.
|
||||
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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 <https://github.com/3rd/image.nvim#default-configuration> 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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue