Skip to content

Commit

Permalink
feat(media): add image.nvim (#742)
Browse files Browse the repository at this point in the history
* feat(media): added image.nvim plugin

* Update lua/astrocommunity/media/image-nvim/README.md

---------

Co-authored-by: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com>
  • Loading branch information
belafonte and Uzaaft committed Feb 4, 2024
1 parent 98df474 commit 6398af8
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lua/astrocommunity/media/image-nvim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# image.nvim

This plugin attempts to add image support to Neovim.

**Repository:** <https://github.com/3rd/image.nvim>

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)
- Magick LuaRock requires Lua 5.1
* 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**
44 changes: 44 additions & 0 deletions lua/astrocommunity/media/image-nvim/init.lua
Original file line number Diff line number Diff line change
@@ -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
},
}

0 comments on commit 6398af8

Please sign in to comment.