Hi In Gvim I need to insert a blank line or two before every comment in the file.
Eg
#comment 1
#comment 2
statement 1
statement 2
#comment 3
After running the comamnd it should be
#comment 1
#comment 2
statement 1
statement 2
#comment 3
How do i do this?
Thanks
Update: Thanks for the answers
But if the comments are continuous, i do not want newline to be added in between them. Is there a way to do this?
eg
#comment 1
#comment 2
I dont to want it to be
#comment 1
#comment 2
You can also use this command:
:g/^#/norm OOk, here is an explanation:
This is a shortcut of
:global/^#/normal Owhich means::global/^#/)normal O) – which means to do what a ‘O’ key does in the ‘normal’ (not insert and not :command) VIM mode. And ‘O’ inserts a new line.