nvim: Fix image.nvim functionality
Track master since no new version has been tagged. Change some settings around and make installation more robust using the new lazy rocks system.
This commit is contained in:
parent
9d15bc79f4
commit
101937a8c2
2 changed files with 32 additions and 36 deletions
|
|
@ -22,7 +22,7 @@
|
||||||
"glance.nvim": { "branch": "master", "commit": "1a08824835d7582457b67acbe23ca33487912a5e" },
|
"glance.nvim": { "branch": "master", "commit": "1a08824835d7582457b67acbe23ca33487912a5e" },
|
||||||
"grug-far.nvim": { "branch": "main", "commit": "635e69adf3a714621bd0a289314bc23c5848babb" },
|
"grug-far.nvim": { "branch": "main", "commit": "635e69adf3a714621bd0a289314bc23c5848babb" },
|
||||||
"helpview.nvim": { "branch": "main", "commit": "34be34afd0811dee17e6b0c46176d9140659fe8e" },
|
"helpview.nvim": { "branch": "main", "commit": "34be34afd0811dee17e6b0c46176d9140659fe8e" },
|
||||||
"image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" },
|
"image.nvim": { "branch": "master", "commit": "6ffafab2e98b5bda46bf227055aa84b90add8cdc" },
|
||||||
"img-clip.nvim": { "branch": "main", "commit": "28a32d811d69042f4fa5c3d5fa35571df2bc1623" },
|
"img-clip.nvim": { "branch": "main", "commit": "28a32d811d69042f4fa5c3d5fa35571df2bc1623" },
|
||||||
"jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" },
|
"jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
|
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,11 @@ return {
|
||||||
ft = { "quarto" },
|
ft = { "quarto" },
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- image display
|
||||||
|
{
|
||||||
|
"3rd/image.nvim",
|
||||||
|
version = false,
|
||||||
|
dependencies = {
|
||||||
{
|
{
|
||||||
"vhyrro/luarocks.nvim",
|
"vhyrro/luarocks.nvim",
|
||||||
priority = 1001, -- this plugin needs to run before anything else
|
priority = 1001, -- this plugin needs to run before anything else
|
||||||
|
|
@ -60,41 +65,32 @@ return {
|
||||||
rocks = { "magick" },
|
rocks = { "magick" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- image display
|
{ "nvim-treesitter/nvim-treesitter", optional = true },
|
||||||
{
|
},
|
||||||
"3rd/image.nvim",
|
opts = {
|
||||||
dependencies = { "luarocks.nvim", { "nvim-treesitter/nvim-treesitter", optional = true } },
|
backend = "kitty",
|
||||||
cond = vim.fn.executable("magick") == 1, -- only runs if imagemagick installed
|
editor_only_render_when_focused = true,
|
||||||
config = function()
|
-- TODO: Check that this works without TS md parser, norg or typst installed
|
||||||
local integrations = {}
|
-- If errors go back to commit before 87691932 when this check was still here
|
||||||
if vim.treesitter.language.get_lang("markdown") then
|
integrations = {
|
||||||
integrations["markdown"] = {
|
markdown = {
|
||||||
enabled = true,
|
|
||||||
clear_in_insert_mode = true,
|
|
||||||
download_remote_images = true,
|
|
||||||
only_render_image_at_cursor = true,
|
only_render_image_at_cursor = true,
|
||||||
filetypes = { "markdown", "vimwiki", "quarto" },
|
filetypes = { "markdown", "vimwiki", "quarto" },
|
||||||
}
|
},
|
||||||
end
|
neorg = {
|
||||||
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,
|
only_render_image_at_cursor = true,
|
||||||
filetypes = { "norg" },
|
},
|
||||||
}
|
typst = {
|
||||||
end
|
only_render_image_at_cursor = true,
|
||||||
if next(integrations) ~= nil then -- only set up if we have at least 1 TS parser
|
},
|
||||||
require("image").setup({
|
},
|
||||||
backend = "kitty",
|
},
|
||||||
integrations = integrations,
|
config = function(_, opts)
|
||||||
})
|
require("image").setup(opts)
|
||||||
vim.g.molten_image_provider = "image.nvim"
|
vim.g.molten_image_provider = "image.nvim"
|
||||||
pcall(vim.fn.MoltenUpdateOption, "molten_image_provider", "image.nvim")
|
pcall(vim.fn.MoltenUpdateOption, "molten_image_provider", "image.nvim")
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
ft = { "markdown", "vimwiki", "quarto", "norg", "python" },
|
ft = { "markdown", "vimwiki", "quarto", "norg", "typst", "python" },
|
||||||
priority = 60,
|
priority = 60,
|
||||||
},
|
},
|
||||||
-- REPL work
|
-- REPL work
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue