2022-09-12 13:48:29 +02:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
local function img_name()
|
|
|
|
vim.fn.inputsave()
|
|
|
|
local name = vim.fn.input('Name: ')
|
|
|
|
vim.fn.inputrestore()
|
|
|
|
|
|
|
|
if name == nil or name == '' then
|
|
|
|
return os.date('%y-%m-%d-%H-%M-%S')
|
|
|
|
end
|
|
|
|
return name
|
|
|
|
end
|
|
|
|
|
|
|
|
function M.setup()
|
|
|
|
require 'clipboard-image'.setup {
|
|
|
|
default = {
|
|
|
|
img_name = img_name
|
|
|
|
},
|
|
|
|
tex = {
|
|
|
|
img_dir = { "%:p:h", "img" },
|
2022-09-25 22:03:11 +02:00
|
|
|
affix = "\\includegraphics[width=\\textwidth]{%s}",
|
2022-09-12 13:48:29 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-10-09 03:28:51 +02:00
|
|
|
vim.keymap.set("n", "<leader>p", ":PasteImg<cr>", { desc = "Paste image from clipboard" })
|
2022-09-12 13:48:29 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|