mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 10:59:49 +01:00
utility/images: add image.nvim
This commit is contained in:
parent
024e1a6845
commit
7cb428520b
10 changed files with 194 additions and 3 deletions
|
@ -178,10 +178,14 @@ inputs: let
|
||||||
hop.enable = true;
|
hop.enable = true;
|
||||||
leap.enable = true;
|
leap.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
images = {
|
||||||
|
image-nvim.enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
vim.notes = {
|
vim.notes = {
|
||||||
obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled
|
obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled
|
||||||
orgmode.enable = false;
|
orgmode.enable = false;
|
||||||
mind-nvim.enable = isMaximal;
|
mind-nvim.enable = isMaximal;
|
||||||
todo-comments.enable = true;
|
todo-comments.enable = true;
|
||||||
|
|
17
flake.lock
17
flake.lock
|
@ -596,6 +596,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"image-nvim": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1707861531,
|
||||||
|
"narHash": "sha256-mh3J3lW2Co2uA7YJzSGum0ZmpJBP0ZzBWUvJLAI9bHw=",
|
||||||
|
"owner": "3rd",
|
||||||
|
"repo": "image.nvim",
|
||||||
|
"rev": "4c6cb5ad93ee93d8d7b7c84e1eb291cee99f0a0e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "3rd",
|
||||||
|
"repo": "image.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"indent-blankline": {
|
"indent-blankline": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1516,6 +1532,7 @@
|
||||||
"highlight-undo": "highlight-undo",
|
"highlight-undo": "highlight-undo",
|
||||||
"hop-nvim": "hop-nvim",
|
"hop-nvim": "hop-nvim",
|
||||||
"icon-picker-nvim": "icon-picker-nvim",
|
"icon-picker-nvim": "icon-picker-nvim",
|
||||||
|
"image-nvim": "image-nvim",
|
||||||
"indent-blankline": "indent-blankline",
|
"indent-blankline": "indent-blankline",
|
||||||
"kommentary": "kommentary",
|
"kommentary": "kommentary",
|
||||||
"leap-nvim": "leap-nvim",
|
"leap-nvim": "leap-nvim",
|
||||||
|
|
|
@ -162,6 +162,11 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
image-nvim = {
|
||||||
|
url = "github:3rd/image.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# Tidal cycles
|
# Tidal cycles
|
||||||
tidalcycles = {
|
tidalcycles = {
|
||||||
url = "github:mitchmindtree/tidalcycles.nix";
|
url = "github:mitchmindtree/tidalcycles.nix";
|
||||||
|
|
|
@ -98,6 +98,7 @@ with lib; let
|
||||||
"vim-dirtytalk"
|
"vim-dirtytalk"
|
||||||
"highlight-undo"
|
"highlight-undo"
|
||||||
"nvim-docs-view"
|
"nvim-docs-view"
|
||||||
|
"image-nvim"
|
||||||
];
|
];
|
||||||
# You can either use the name of the plugin or a package.
|
# You can either use the name of the plugin or a package.
|
||||||
pluginType = with types;
|
pluginType = with types;
|
||||||
|
@ -116,11 +117,13 @@ with lib; let
|
||||||
type = pluginType;
|
type = pluginType;
|
||||||
description = "Plugin Package.";
|
description = "Plugin Package.";
|
||||||
};
|
};
|
||||||
|
|
||||||
after = mkOption {
|
after = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "Setup this plugin after the following ones.";
|
description = "Setup this plugin after the following ones.";
|
||||||
};
|
};
|
||||||
|
|
||||||
setup = mkOption {
|
setup = mkOption {
|
||||||
type = lines;
|
type = lines;
|
||||||
default = "";
|
default = "";
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./binds
|
./binds
|
||||||
|
./ccc
|
||||||
./gestures
|
./gestures
|
||||||
./motion
|
./motion
|
||||||
./telescope
|
./telescope
|
||||||
./ccc
|
|
||||||
./icon-picker
|
./icon-picker
|
||||||
|
./images
|
||||||
./telescope
|
./telescope
|
||||||
./diffview
|
./diffview
|
||||||
./wakatime
|
./wakatime
|
||||||
|
|
6
modules/utility/images/default.nix
Normal file
6
modules/utility/images/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
#./hologram
|
||||||
|
./image-nvim
|
||||||
|
];
|
||||||
|
}
|
6
modules/utility/images/hologram/default.nix
Normal file
6
modules/utility/images/hologram/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./hologram.nix
|
||||||
|
];
|
||||||
|
}
|
27
modules/utility/images/image-nvim/config.nix
Normal file
27
modules/utility/images/image-nvim/config.nix
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) nvim mkIf attrValues;
|
||||||
|
|
||||||
|
cfg = config.vim.utility.images.image-nvim;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins =
|
||||||
|
[
|
||||||
|
"image-nvim"
|
||||||
|
# TODO: needs luarockss here somehow
|
||||||
|
]
|
||||||
|
++ (attrValues {inherit (pkgs) luarocks imagemagick;});
|
||||||
|
|
||||||
|
luaConfigRC.image-nvim = nvim.dag.entryAnywhere ''
|
||||||
|
require("image").setup(
|
||||||
|
${nvim.lua.toLuaObject cfg.setupOpts}
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
modules/utility/images/image-nvim/default.nix
Normal file
6
modules/utility/images/image-nvim/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./image-nvim.nix
|
||||||
|
];
|
||||||
|
}
|
116
modules/utility/images/image-nvim/image-nvim.nix
Normal file
116
modules/utility/images/image-nvim/image-nvim.nix
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkEnableOption mkOption nvim types;
|
||||||
|
in {
|
||||||
|
options.vim.utility.images.image-nvim = {
|
||||||
|
enable = mkEnableOption "image support in Neovim [image.nvim]";
|
||||||
|
|
||||||
|
setupOpts = nvim.types.mkPluginSetupOption "image.nvim" {
|
||||||
|
backend = mkOption {
|
||||||
|
type = types.enum ["kitty" "ueberzug"];
|
||||||
|
default = "ueberzug";
|
||||||
|
description = ''
|
||||||
|
The backend to use for rendering images.
|
||||||
|
|
||||||
|
- kitty - best in class, works great and is very snappy
|
||||||
|
- ueberzug - backed by ueberzugpp, supports any terminal,
|
||||||
|
but has lower performance
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
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 = with types; 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 = with types; listOf str;
|
||||||
|
default = ["neorg"];
|
||||||
|
description = ''
|
||||||
|
Filetypes to enable image.nvim in.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
maxWidth = mkOption {
|
||||||
|
type = with types; 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 {
|
||||||
|
type = with types; 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 = with types; 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 = with types; 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 = with types; 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 = with types; listOf str;
|
||||||
|
default = ["*.png" "*.jpg" "*.jpeg" "*.gif" "*.webp"];
|
||||||
|
description = ''
|
||||||
|
File patterns to hijack for image.nvim. This is useful for
|
||||||
|
filetypes that don't have a dedicated integration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue