nvim: Add keymap to toggle rendering all images
By default we only render the image at the cursor. Should we want to render all images instead we can now toggle this for image.nvim with <localleader>pi. To enable this we move the 'paste image' shortcut for prose formats onto <localleader>pp instead.
This commit is contained in:
parent
9b7290c93c
commit
a3a5488dcd
2 changed files with 11 additions and 1 deletions
|
|
@ -93,6 +93,16 @@ return {
|
|||
else
|
||||
vim.g.molten_image_provider = "image.nvim"
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<localleader>pi", function()
|
||||
for k, v in pairs(opts.integrations) do
|
||||
if v["only_render_image_at_cursor"] ~= nil then
|
||||
v["only_render_image_at_cursor"] = not v["only_render_image_at_cursor"]
|
||||
end
|
||||
print(k, v)
|
||||
end
|
||||
require("image").setup(opts)
|
||||
end, { desc = "toggle image rendering", silent = true })
|
||||
end,
|
||||
ft = { "markdown", "vimwiki", "quarto", "norg", "typst", "python" },
|
||||
priority = 60,
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ local prose_plugs = {
|
|||
},
|
||||
cmd = { "PasteImage" },
|
||||
keys = {
|
||||
{ "<localleader>pi", "<cmd>PasteImage<cr>", desc = "Paste image from system clipboard" },
|
||||
{ "<localleader>pp", "<cmd>PasteImage<cr>", desc = "Paste image from system clipboard" },
|
||||
},
|
||||
ft = prose_ft,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue