nvim: Set up image.nvim image display

Finally got image.nvim fully working on wezterm with the kitty backend
and auto-installed rock dependencies.
This commit is contained in:
Marty Oehme 2024-06-16 21:30:20 +02:00
parent e25aedd94b
commit 0ec49583bd
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 40 additions and 15 deletions

View file

@ -38,6 +38,7 @@
"lazy.nvim": { "branch": "main", "commit": "fafe1f7c640aed75e70a10e6649612cd96f39149" },
"lsp-setup.nvim": { "branch": "main", "commit": "6e4e977512ce426d8b52c27f3b6e6aefc73e1452" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" },
"markmap.nvim": { "branch": "main", "commit": "5fb6755cf5434511cc23a4936c9eb76b9142fba5" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
@ -84,6 +85,7 @@
"vim-pandoc-syntax": { "branch": "master", "commit": "16939cda184ff555938cc895cc62477c172997f9" },
"vim-scimark": { "branch": "master", "commit": "9b66a88fa4bb87b8baab3c4aecc43b985b32e7fd" },
"vim-spellsync": { "branch": "master", "commit": "3d6dd50de9c4d953cc16638112a6ae196df41463" },
"wezterm.nvim": { "branch": "main", "commit": "f73bba23ab4becd146fa2d0a3a16a84b987eeaca" },
"which-key.nvim": { "branch": "main", "commit": "0539da005b98b02cf730c1d9da82b8e8edb1c2d2" },
"wrapping.nvim": { "branch": "master", "commit": "3a823200c297885b70515fa8d974e1763c578e26" },
"zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" },

View file

@ -50,25 +50,48 @@ return {
ft = { "quarto" },
},
{
"vhyrro/luarocks.nvim",
priority = 1001, -- this plugin needs to run before anything else
opts = {
rocks = { "magick" },
},
},
-- image display
{
"3rd/image.nvim",
dependencies = { "luarocks.nvim" },
cond = vim.fn.executable("magick") == 1, -- only runs if imagemagick installed
config = function()
-- Example for configuring Neovim to load user-installed installed Lua rocks:
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;"
require("image").setup({
backend = "kitty",
integrations = {
markdown = {
enabled = true,
download_remote_images = true,
only_render_image_at_cursor = true,
filetypes = { "markdown", "vimwiki", "quarto" },
},
},
})
local integrations = {}
if vim.treesitter.language.get_lang("markdown") then
integrations["markdown"] = {
enabled = true,
clear_in_insert_mode = true,
download_remote_images = true,
only_render_image_at_cursor = true,
filetypes = { "markdown", "vimwiki", "quarto" },
}
end
if vim.treesitter.language.get_lang("norg") then
integrations["neorg"] = {
enabled = true,
clear_in_insert_mode = true,
download_remote_images = true,
only_render_image_at_cursor = true,
filetypes = { "norg" },
}
end
if next(integrations) ~= nil then -- only set up if we have at least 1 TS parser
require("image").setup({
backend = "kitty",
integrations = integrations,
})
vim.g.molten_image_provider = "image.nvim"
end
end,
ft = { "markdown", "vimwiki", "quarto" },
ft = { "markdown", "vimwiki", "quarto", "norg", "python" },
priority = 51,
},
-- REPL work
{