So I am pretty new to vim, but I have started using it as my Latex editor to help get more efficient. Anyways I have a recording that I would like to prompt a user for input on that will change how the recording goes. I am looking for some way of doing the following:
qa
i
\begin{theorem}[XXX] #where XXX is the name of the theorem given by the user
\end{theorem}
ESC
<C-o>q
The idea would be that @a would wait for a prompt like "Pythagorean Theorem", and replace XXX above, and otherwise would leave [ ] blank. Is there an easy way to do this? Thanks in advance for anything you can recommend.
EDIT 1:
I have tried using functions outside of the file that take an input like:
function! GetTheorem()
let curline = getline('.')
call inputsave()
let thm = input('Theorem Name: ')
call inputrestore()
call setline('.', curline . '[' . thm . ']')
endfunction
Which is stored in GetTheorem.vim. But when I set that as the source file for the code I end up getting only to the point where vim outputs:
\begin{theorem}[XXX]
And just ignores the rest of the macro commands even though it still says that it is "recording" as I was putting it together. Any Ideas how to fix that issue?