From 2129ddf30af3d3ea1b45e5ba6670b86b1621ac51 Mon Sep 17 00:00:00 2001 From: Jan Pistor Date: Mon, 29 Jan 2024 09:54:24 +0100 Subject: [PATCH 1/2] feat(media): added image.nvim plugin --- lua/astrocommunity/media/image-nvim/README.md | 22 ++++++++++ lua/astrocommunity/media/image-nvim/init.lua | 44 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 lua/astrocommunity/media/image-nvim/README.md create mode 100644 lua/astrocommunity/media/image-nvim/init.lua diff --git a/lua/astrocommunity/media/image-nvim/README.md b/lua/astrocommunity/media/image-nvim/README.md new file mode 100644 index 000000000..aae349741 --- /dev/null +++ b/lua/astrocommunity/media/image-nvim/README.md @@ -0,0 +1,22 @@ +# image.nvim + +This plugin attempts to add image support to Neovim. + +**Repository:** + +Works with Kitty + Tmux, and it handles painful things like rendering an image at a given position in a buffer, scrolling, windows, etc. + +It has built-in Markdown and Neorg integrations that you can use right now. +It can also render image files as images when opened. + +**Requirements** + +These are things you have to setup on your own + +* ImageMagick - **mandatory** +* magick LuaRock - **mandatory** (luarocks --local --lua-version=5.1 install magick) +* Kitty >= 28.0 - for the kitty backend +* ueberzugpp - for the ueberzug backend +* curl - for remote images + +**This plugin is configured to be used with kitty terminal and lua 5.1** diff --git a/lua/astrocommunity/media/image-nvim/init.lua b/lua/astrocommunity/media/image-nvim/init.lua new file mode 100644 index 000000000..b9a53c3e2 --- /dev/null +++ b/lua/astrocommunity/media/image-nvim/init.lua @@ -0,0 +1,44 @@ +package.path = package.path .. ";" .. vim.fn.expand "$HOME" .. "/.luarocks/share/lua/5.1/?/init.lua;" +package.path = package.path .. ";" .. vim.fn.expand "$HOME" .. "/.luarocks/share/lua/5.1/?.lua;" + +return { + "3rd/image.nvim", + event = "VeryLazy", + dependencies = { + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup { + ensure_installed = { "markdown" }, + highlight = { enable = true }, + } + end, + }, + }, + opts = { + backend = "kitty", + integrations = { + markdown = { + enabled = true, + clear_in_insert_mode = false, + download_remote_images = true, + only_render_image_at_cursor = false, + filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here + }, + neorg = { + enabled = true, + clear_in_insert_mode = false, + download_remote_images = true, + only_render_image_at_cursor = false, + filetypes = { "norg" }, + }, + }, + max_width = nil, + max_height = nil, + max_width_window_percentage = nil, + max_height_window_percentage = 50, + kitty_method = "normal", + hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp" }, -- render image files as images when opened + }, +} From 064c1d3dbdc7d332537c6003f18a5856c73be435 Mon Sep 17 00:00:00 2001 From: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com> Date: Sun, 4 Feb 2024 11:52:11 +0100 Subject: [PATCH 2/2] Update lua/astrocommunity/media/image-nvim/README.md --- lua/astrocommunity/media/image-nvim/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/astrocommunity/media/image-nvim/README.md b/lua/astrocommunity/media/image-nvim/README.md index aae349741..975224d5a 100644 --- a/lua/astrocommunity/media/image-nvim/README.md +++ b/lua/astrocommunity/media/image-nvim/README.md @@ -15,6 +15,7 @@ These are things you have to setup on your own * ImageMagick - **mandatory** * magick LuaRock - **mandatory** (luarocks --local --lua-version=5.1 install magick) + - Magick LuaRock requires Lua 5.1 * Kitty >= 28.0 - for the kitty backend * ueberzugpp - for the ueberzug backend * curl - for remote images