Skip to content

Pasting creates an empty PNG image #122

@ahmedelgabri

Description

@ahmedelgabri

Describe the bug
Similar to #92 when I paste an image (I have pngpaste installed) it creates an empty .png image instead.

Here is my config

{
	'https://github.com/hakonharnes/img-clip.nvim',
	event = 'VeryLazy',
	cmd = { 'PasteImage', 'ImgClipDebug', 'ImgClipConfig' },
	ft = { 'markdown', 'codecompanion' },
	keys = {
		{
			'<C-p>',
			vim.cmd.PasteImage,
			noremap = true,
			desc = 'Paste image from system clipboard',
		},
	},
	opts = {
		default = {
			file_name = '%Y-%m-%d-%H-%M-%S',
			prompt_for_file_name = false,
		},
		filetypes = {
			markdown = {
				url_encode_path = true,
				template = '![$FILE_NAME]($FILE_PATH)',
			},
		},
	},
},

Steps to reproduce
Steps to reproduce the behavior:

  1. Open a file (in my case a markdown file)
  2. Copy the image to your clipboard
  3. Paste the image with the keymap
  4. See that the new image created is an empty image

Expected behavior
To get the correct image

Screenshots

Kapture.2025-04-15.at.12.01.00.mp4

Desktop (please complete the following information):

  • OS: macOS Sequoia 15.4
  • Neovim version: 0.11
  • Terminal: Ghostty (I tested in Kitty too) both with and without tmux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternal

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions