From e39e3836e513f66978a241fde9bd87c8d6aa85b4 Mon Sep 17 00:00:00 2001 From: Joost Agterhoek Date: Wed, 9 Jul 2025 11:35:52 +0200 Subject: [PATCH] pastify --- lua/plugins/pastify.lua | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lua/plugins/pastify.lua diff --git a/lua/plugins/pastify.lua b/lua/plugins/pastify.lua new file mode 100644 index 0000000..b782c4f --- /dev/null +++ b/lua/plugins/pastify.lua @@ -0,0 +1,49 @@ +local path = vim.fn.expand '%:h' +return { + 'TobinPalmer/pastify.nvim', + cmd = { 'Pastify', 'PastifyAfter' }, + event = { 'BufReadPost' }, -- Load after the buffer is read, I like to be able to paste right away + keys = { + { noremap = true, mode = 'x', 'p', 'PastifyAfter' }, + { noremap = true, mode = 'n', 'p', 'PastifyAfter' }, + { noremap = true, mode = 'n', 'P', 'Pastify' }, + }, + config = function() + require('pastify').setup { + opts = { + -- absolute_path = true, -- use absolute or relative path to the working directory + absolute_path = false, + apikey = '', -- Api key, required for online saving + -- local_path = path .. '/attachments/', -- The path to put local files in, ex ~/Projects//assets/images/.png + local_path = '', + save = 'local_file', -- Either 'local' or 'online' or 'local_file' + filename = function() + return vim.fn.expand '%:t:r' .. '_' .. os.date '%Y-%m-%d_%H-%M-%S' + end, + default_ft = 'markdown', -- Default filetype to use + }, + ft = { -- Custom snippets for different filetypes, will replace $IMG$ with the image url + html = '', + markdown = '![]($IMG$)', + tex = [[\includegraphics[width=\linewidth]{$IMG$}]], + css = 'background-image: url("$IMG$");', + js = 'const img = new Image(); img.src = "$IMG$";', + xml = '', + php = '"; ?>', + python = '# $IMG$', + java = '// $IMG$', + c = '// $IMG$', + cpp = '// $IMG$', + swift = '// $IMG$', + kotlin = '// $IMG$', + go = '// $IMG$', + typescript = '// $IMG$', + ruby = '# $IMG$', + vhdl = '-- $IMG$', + verilog = '// $IMG$', + systemverilog = '// $IMG$', + lua = '-- $IMG$', + }, + } + end, +}