img-paste-devs / img-paste.vim

paste image to markdown
383 stars 86 forks source link

Set image size? #59

Closed LogicNg closed 3 years ago

LogicNg commented 3 years ago

My first thought is to use <img src="drawing.jpg" alt="drawing" width="200"/>, where should I change the code?

LogicNg commented 3 years ago

Just figured it out

execute "normal! i![" . g:mdip_tmpname[0:0]
let ipos = getcurpos()
execute "normal! a" . g:mdip_tmpname[1:] . "](" . relpath . ")"
call setpos('.', ipos)
execute "normal! vt]\<C-g>"

Change to

execute "normal! a<img src=\"".relpath."\" style=\"zoom:%"
let ipos = getcurpos()
execute "normal! a\">"
call setpos('.', ipos)
startinsert

and you're good to go