I have the following bit of text in a vim file with cursor where the asterisk is while in insert mode:
\begin{document}
[latex]
Some text*
[\latex]
\end{document}
\begin{document}
[latex]
[\latex]
\end{document}
I want to hit ctrl-A to search for the next instance of [latex
and insert a new line after that with this:
inoremap ^A <esc>execute "normal! /^[latex\<cr>o"
However, what happens instead is the first instance of [\latex]
gets changed to [latex]
with the cursor over the x. What has me baffled is that this works fine when I type in the keystrokes manually.
How do I get vim to do it what I want?