Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(media): add image.nvim #742

Merged
merged 2 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Uzaaft marked this conversation as resolved.
Show resolved Hide resolved
- 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**
Uzaaft marked this conversation as resolved.
Show resolved Hide resolved
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
},
}
Loading