Hi,

If all the lines in a file only contains 2 words [column & int], you can even 
write a one line awk command to indent it.

cat data.txt | awk '{print "   "$1"  "$2}'  > indented_data.txt


----- Original Message ----
From: A.J.Mechelynck <[EMAIL PROTECTED]>
To: Lev Lvovsky <[EMAIL PROTECTED]>
Cc: vim users list <[email protected]>
Sent: Tuesday, February 27, 2007 8:10:44 AM
Subject: Re: pulling text to the right?

Lev Lvovsky wrote:
> I'm sure there's a fancy word for this, but is there any way to pull 
> text to the right?
> 
> suppose I have the following:
> 
>      COL1  INT,
>      COL2  INT,
>  COL3       INT,
> 
> I'd like to get "COL3" aligned to "COL1" and "COL2", but to do that, I 
> need to put the cursor behind "COL3", hit space several times, and then 
> align "INT" with the other "INTs".  Can I put my cursor to the right of 
> "COL3", and pull it over to "INT" on the right?
> 
> thanks!
> -lev
> 

With 'autoindent' on, place the cursor at the end of the second line in Insert 
mode, hit <Del> to join the lines, then <Enter> to break them again. The third 
line will align itself with the second one regardless of how many spaces are 
between the cursor and the first word (try it, you'll see). This won't align 
INT though, but there are several possible ways to do that after COL3 has been 
aligned. One of the fastest of these methods is to drag the mouse across all 
the spaces to be deleted to the left of INT in the third line, then hit <Del>.

An alternative possibility would be to write an ad-hoc 'indentextpr' function, 
then reformat the whole file with gggqG -- but I wouldn't do that unless there 
were really many such "misindents" to correct.


Best regards,
Tony.






 
____________________________________________________________________________________
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091

Reply via email to