image and pastify working

This commit is contained in:
Joost Agterhoek 2025-07-09 14:05:39 +02:00
parent b876cf8eb9
commit facf2f9ecb
2 changed files with 10 additions and 49 deletions

View File

@ -10,13 +10,14 @@ return {
markdown = {
enabled = true,
only_render_image_at_cursor = true,
only_render_image_at_cursor_mode = true,
floating_windows = true,
only_render_image_at_cursor_mode = "inline",
floating_windows = false,
},
html = {
enabled = true,
},
},
-- tmux_show_only_in_active_window = true,
})
end,
}

View File

@ -1,49 +1,9 @@
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', '<leader>p', '<cmd>PastifyAfter<CR>' },
{ noremap = true, mode = 'n', '<leader>p', '<cmd>PastifyAfter<CR>' },
{ noremap = true, mode = 'n', '<leader>P', '<cmd>Pastify<CR>' },
},
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/<name>/assets/images/<imgname>.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 = '<img src="$IMG$" alt="">',
markdown = '![]($IMG$)',
tex = [[\includegraphics[width=\linewidth]{$IMG$}]],
css = 'background-image: url("$IMG$");',
js = 'const img = new Image(); img.src = "$IMG$";',
xml = '<image src="$IMG$" />',
php = '<?php echo "<img src="$IMG$" alt="">"; ?>',
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,
"TobinPalmer/pastify.nvim",
cmd = { "Pastify", "PastifyAfter" },
config = function()
require("pastify").setup({
opts = {},
})
end,
}