Re: aligning text to a certain column

2006-12-05 Thread Jean-Rene David
* Lev Lvovsky [2006.12.05 13:53]:
 how can I align text under and after the cursor
 position to a  specific column number?  

:.,$s/^\s*/   /g

will align the first non-blank on the fourth
column, from the cursor's line to the end of the
file.

 and probably just as important, how can I  
 find out which column number a cursor is at ;)?

In normal mode:
:h g_Ctrl-G

In scripts:
:h getpos()

or add %c to your status line to have it all the
time.

:h statuslineCR7}

-- 
JR


Re: aligning text to a certain column

2006-12-05 Thread Gary Johnson
On 2006-12-05, Lev Lvovsky [EMAIL PROTECTED] wrote:
 how can I align text under and after the cursor position to a  
 specific column number?  and probably just as important, how can I  
 find out which column number a cursor is at ;)?

:set ruler

will show you the cursor's line and column numbers on the status 
line.  Then the easiest was to align the text under and after the 
cursor to a specific column number is to hit 'i' and hold the space 
bar or backspace key as appropriate until the 'ruler' shows the 
desired column number.  There are more elegant solutions, but they 
depend on the specifics of what you're trying to do.

HTH,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
 | Spokane, Washington, USA


Re: aligning text to a certain column

2006-12-05 Thread A.J.Mechelynck

Jean-Rene David wrote:

* Lev Lvovsky [2006.12.05 13:53]:

how can I align text under and after the cursor
position to a  specific column number?  


:.,$s/^\s*/   /g

will align the first non-blank on the fourth
column, from the cursor's line to the end of the
file.

and probably just as important, how can I  
find out which column number a cursor is at ;)?


In normal mode:
:h g_Ctrl-G

In scripts:
:h getpos()

or add %c to your status line to have it all the
time.

:h statuslineCR7}



The default status line (when 'statusline' is set to the empty string) has it. 
To enable status line display even if only one window is open, use


:set laststatus=2

For instance, after doing :help 'laststatus' (with the single quotes but 
without the double quotes), I see 4193,6-41 near the bottom right of the 
screen. This means:


- cursor is on 4193rd line in the file;
- cursor is on 6th byte in the line (counting each hard tab as one byte, and 
each multibyte character -if any- as however many bytes it takes up in memory);

- cursor is on 41st column of the screen.

When both horizontal position numbers are equal, their value appears only 
once. When there is no data in the file, 0,0-1 is displayed.



Best regards,
Tony.