On Mon, Feb 26, 2007 at 07:30:09PM EST, 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?

I have this mapping in my ~/.vimrc that lets me enter spaces while
remaining in "normal" mode:

:nmap <space> i <esc>

So in the above example I would enter:

G               /* move cursor to last line - COL3 ..            */
3<spacebar>     /* move COL3 three columns to the right          */
e               /* move the cursor to the '3' of COL3            */
l               /* move the cursor to the space after COL3       */
3x              /* delete three spaces to the right of COL3      */

Sounds like a lot of work but all it really adds up to is seven
easy keystrokes and the hands remain positioned on the home row.

Compare with, for instance:

<down-arrow><down-arrow><down-arrow>
i
<space><space><space>
<escape>
<right-arrow><right-arrow><right-arrow><right-arrow>
<delete><delete><delete>

.. fifteen keystrokes (and several moves to difficult-to reach keys)

It's obviously not what you were looking for .. but once you get used to
cursor movement commands that go beyond h,j,k,l (or worse .. arrow keys)
it can be done quickly & effortlessly.  

I admit that fluency does require a few months of practice so it's
really for you to decide whether it's worth the trouble.

Thanks,
cga

Reply via email to