Vim Macros: Insert Mode

vim

Solution

You can use `<C-o>q` to finish recording while in insert mode. `<C-o>` in insert mode allows you to execute one command in normal mode, and then returns to insert mode (see `:help i^O`).

Problem

I am trying to create an insert macro where if I type in the command @f it should print out a for loop. I got that part working. However, I would like to leave the user in insert mode before the 1st semicolon. I tried to leave the last command before I quit the record as 'a' for append, but that did not work. Any suggestions?

Original source