nvim: Allow pasting images into markup files

With the new `img-clip.nvim` extension we can copy any image anywhere
and simply paste it into a markdown/quarto/latex/typst/... document with
the right markup already.

Those can be from the web/locally. Also allows drag and drop from e.g.
web pages.

Mapped to `<leader>pp` currently, though we will have to find a better
mapping. Or invoked with `:ImagePaste`.
This commit is contained in:
Marty Oehme 2024-06-16 21:34:52 +02:00
parent 3b1a874883
commit b2c64a0925
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
3 changed files with 25 additions and 3 deletions

View file

@ -1,4 +1,4 @@
local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex" }
local writing_ft = { "quarto", "pandoc", "markdown", "text", "tex", "typst" }
local prose_plugs = {
-- UI improvements
@ -69,6 +69,26 @@ local prose_plugs = {
ft = writing_ft,
},
-- easy copy paste of images into markup files
{
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
opts = {
filetypes = {
quarto = {
url_encode_path = true,
template = "![$CURSOR]($FILE_PATH)",
download_images = false,
},
},
},
cmd = { "PasteImage" },
keys = {
{ "<leader>pp", "<cmd>PasteImage<cr>", desc = "Paste image from system clipboard" },
},
ft = writing_ft,
},
-- bring zettelkasten commands
{
"mickael-menu/zk-nvim",
@ -111,6 +131,7 @@ local prose_plugs = {
"ZkOrphans",
},
keys = {
-- additional key instpirations https://github.com/al1-ce/MonolithVim/blob/master/after/ftplugin/markdown.lua
{ "<leader>ni", "<cmd>edit ~/documents/notes/index.md<cr>", desc = "open index", silent = true },
{ "<leader>nn", "<cmd>ZkNotes { sort = { 'modified' } }<cr>", desc = "note list" },
{