Skip to content

Commit

Permalink
feat(media): add image.nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
belafonte committed Jan 29, 2024
1 parent f39e1d4 commit 9e5abbe
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lua/astrocommunity/media/image-nvim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# image.nvim

This plugin attempts to add image support to Neovim.

It works wonderfully 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 install magick or through your package manager)
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**

Check the repo for detailed instruction on how to install magick:
**Repository:** <https://github.com/3rd/image.nvim>
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 9e5abbe

Please sign in to comment.