I've some codes copied from the Internet that have 2-space indenting and I want to change it into 4-space indenting. I wonder if there is a short vim routine to accomplish the task without having to write vim script? Here is how I'm currently doing it with an HTML file:
- Record a macro
- Go to the beginning of a line
- Visual select all whitespaces until the first occurrence of "<"
- Yank and paste all whitespaces (basically to double them)
- Replay the macro till the end of the file
In short qa0vt<yp<esc>jq
Pitfalls:
The macro fails for a blank line or a line that doesn't start with "<". And I have no idea how to extend this solution to non-HTML file.