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 statusline<CR>7}


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.

Reply via email to