1
Fork 0
satellite/home/features/neovim/config/lua/my/plugins/clipboard-image.lua

43 lines
756 B
Lua
Raw Normal View History

2023-01-10 02:38:06 +01:00
local M = {
"postfen/clipboard-image.nvim",
2023-01-10 02:38:06 +01:00
cmd = "PasteImg",
}
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.init()
vim.keymap.set(
"n",
"<leader>p",
":PasteImg<cr>",
{ desc = "[P]aste image from clipboard" }
)
end
function M.config()
require("clipboard-image").setup({
default = {
img_name = img_name,
},
tex = {
img_dir = { "%:p:h", "img" },
affix = "\\includegraphics[width=\\textwidth]{%s}",
},
2023-12-02 00:46:56 +01:00
typst = {
img_dir = { "%:p:h", "img" },
affix = '#image("%s", width: 100)',
},
2023-01-10 02:38:06 +01:00
})
end
return M