How do I save a macro consisting of multiple search and replace into my .vimrc

Posted by Doppelganger on Stack Overflow See other posts from Stack Overflow or by Doppelganger
Published on 2010-06-16T15:27:10Z Indexed on 2010/06/16 16:12 UTC
Read the original article Hit count: 337

I have a macro that I use to replace special characters for its html entities. I would like to save it in my .vimrc.

According to this, I should use let @r=' *macro_text_goes_here* '. The problem is that my macro is a series of search and replace, something like this:

:%s:á:\á:Ige
:%s:é:\é:Ige
:%s:í:\í:Ige

So, I've tried with ^V-enter, <enter>, <CR> using real line breaks, but it never works. On the other side, if I put the text on a register and then run the macro, it works as expected.

© Stack Overflow or respective owner

Related posts about vim

Related posts about macro