How to indent the file lines using vi
Every now and then I have to indent the lines in my script to 4 space characters.
I generally do it line by line. Is there an automated command in vi using which I can indent some set of lines to desired number of space characters in one go. |
eg, line 5 to 10
Code:
:5,10s/^/ / |
If "vi" is an alias for "vim", then "gg=G" in command mode will work.
|
Quote:
|
Please mark as SOLVED once you have your solution
@dugan - tried your suggestion but instead of indenting it removed all indent from my file :( Even though at the bottom of the screen it says '10 line indented'?? |
You could also do:
Code:
:5,10> Code:
:'a,'b> Regards, Stefan |
All times are GMT -5. The time now is 02:15 PM. |