I’m using vim to maintain a weblog of what I do through the day (what commands I used to generate output, etc..), and sometimes I need to copy-paste strings that have special html characters in them. Is there a way to make an “html-paste” mode that will (for instance) convert < to <?
Share
There are a few small functions here if someone feels like modifying them to accept a range, then provide a mapping which passes the
[and]marks to act on the last pasted text.Actually, after looking a bit, you don’t need to modify the functions from the vim tip at all. If a function doesn’t explicitly pass the
rangeoption, the function is called once for each line of the given range. This means that all you need to do is call the function with a range.A couple useful examples are below. The first calls HtmlEscape() for each line in the last pasted text, the second does the same but for each line in a visually selected block. Add this to your
.vimrc:Obviously if you want more things replaced you’d have to add them; there are many on the linked wiki page.