1
Fork 0
satellite/dotfiles/neovim/lua/my/plugins/clipboard-image.lua

39 lines
657 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}",
},
})
end
return M