Reputation: 196
I wanted to indent only even numbered lines in a text file using vim. In vim manual, indentation techniques are mentioned. But this will work either for a range of lines or particular line in which cursor positioned. I need a single command that should align the whole file. Is this possible in vim. Shall someone suggest on this.
Upvotes: 3
Views: 1108
Reputation: 7627
To indent even lines:
:g/^/if line('.') % 2==0 | norm! >> | endif
to indent odd lines replace 2==0
with 2!=0
.
Upvotes: 7