How can I script an action in Vim that will take the selected lines, indent them once, jump to the beginning and insert some code, then jump to the end and insert some code?
The code that needs to be inserted at the beginning and end are static and don’t need to change (at least, not at this point).
Let’s say beginning text is
---and ending text is***If you want to record it into a macro, say buffer “a”, then starting with a visual selection, use:
qa start recording into
a> indent
i insert mode
--- start text
Esc normal mode
`> end of last visual selection
a insert after
*** end text
Esc normal mode
q end recording