VIM: how to add search/replace command to vimrc and map to a shortcut

dictionary, replace, search, vim

Solution

You can put the commands on a single line separated with a bar.

:%s!<!\&lt;!g|%s!>!\&gt;!g

But you'll have to escape it in the `map` command

:map <F3> :%s!<!\&lt;!g\|:%s!>!\&gt;!g<CR>

Problem

I have two search/replace commands that I find myself running in vim fairly often to clean up html code so I can copy/paste it online. The commands are: ``` :%s!<!\&lt;!g :%s!>!\&gt;!g ``` I wanted a way I could map both of these commands to be run together ... I did some searching for how to use the `:map` commands in vimrc, however, I can't see how to combine the two lines into a single command that is run with a single keystroke (or a single sequence of strokes). Thanks!

Original source