Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM Plugin to insert image tags via NERDTree

Tags:

vim

I'm trying to find/create a plugin for vim's NERDTree that will allow a shortcut to inserting HTML image tags.

Perhaps something like the solution shown here: VIM browser plugin to execute commands on files

Only I can't get this to work - looks like it uses a perl script to invoke ImageMagick to determine the image dimensions and then generates an HTML tag. This script is not shown in the solution :(

Would be nice if the script would allow a selection of (multiple) images, and auto-pasted the resulting HTML into the last used position of the last used window.

Anyone know of an existing plugin like this, or steer me in the right direction?

like image 810
steddy_eddie Avatar asked May 02 '26 15:05

steddy_eddie


1 Answers

Actually I used to do:

 :e /directory/where/are/images

(this gives me a buffer with directory contents, then)

 V

(selects line(s))

 :%s:.\+:<img src="&" />:

(converts the file names to img tags...)

ggVGya

(all the lines are selected, copied to a register, which can be pasted anywhere...)

HTH

like image 92
Zsolt Botykai Avatar answered May 06 '26 09:05

Zsolt Botykai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!