paste image to markdown
Yet simple tool to paste images into markdown files
You are editing a markdown file and have an image on the clipboard and want to paste it into the document as the text
!(img/image1.png). Instead of first copying it to that directory, you want to do it with a single
pkey press in Vim. So it hooks
p, checks if you are editing a Markdown file, saves the image from the clipboard to the location
img/image1.png, and inserts
!(img/image1.png)into the file.
By default, the location of the saved file (
img/image1.png) and the in-text reference (
!(img/image1.png) are identical. You can change this behavior by specyfing an absolute path to save the file (
let g:mdip_imgdir_absolute = /absolute/path/to/imgdiron linux) and a different path for in-text references (
let g:mdip_imdir_intext = /relative/path/to/imgdiron linux).
Add to .vimrc
autocmd FileType markdown nmap p :call mdip#MarkdownClipboardImage() " there are some defaults for image directory and image name, you can change them " let g:mdip_imgdir = 'img' " let g:mdip_imgname = 'image'
This plugin gets clipboard content by running the