I use the following Vim macro a lot (it puts the current line inside XML tags):
I^[A
So I saved it into my .vimrc
For a macro:
:let @e='^[I^[A '
Where ^[
is just one char formed by hitting CTRL+VESC (CTRL+QESC on Windows). Note the escape right at the beginning of the macro.
See :help c_CTRL-V in Vim for more information.
For those who've landed on this post looking for how to add ESC to a mapping, the answer is different.
Literally type <ESC>, thus:
:nnoremap E IA
See :help key-notation in Vim for more info.