Visual Block: $ vs. ^ inconsistency?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Visual Block: $ vs. ^ inconsistency?

Suresh Govindachar`

Hello,

  In visual block mode (<C-V>) one can get jagged
  right edges by hitting $.  But hitting ^ does not
  result in jagged left edges.  Why the inconsistency?
  Is it something in my set-up?

  Thanks,

  --Suresh

Reply | Threaded
Open this post in threaded view
|

Re: Visual Block: $ vs. ^ inconsistency?

James Vega-3
On Fri, May 19, 2006 at 07:47:41AM -0700, Suresh Govindachar wrote:
>   In visual block mode (<C-V>) one can get jagged
>   right edges by hitting $.  But hitting ^ does not
>   result in jagged left edges.  Why the inconsistency?
>   Is it something in my set-up?

The leftmost column of a line is always 0.  Unless you pad all your
lines on the right, then the rightmost column of every line is going to
be different.  Since $ tells Vim to select until the EOL, this will
cause the visual selection to appear jagged.

If you use set virtualedit to 'block' or 'all', your visual block will
be a solid block as long as you don't use $ to form the selection.
Using the arrow keys or h,j,k,l will behave as you expect.  $ will
always select to the end of the text on the line and not past it.

James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[hidden email]>

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Visual Block: $ vs. ^ inconsistency?

Suresh Govindachar`

   James Vega wrote:
  > On Fri, May 19, 2006 at 07:47:41AM -0700, Suresh Govindachar wrote:
  >
  >>   In visual block mode (<C-V>) one can get jagged
  >>   right edges by hitting $.  But hitting ^ does not
  >>   result in jagged left edges.  Why the inconsistency?
  >>   Is it something in my set-up?
  >
  > The leftmost column of a line is always 0.  
 
  I was asking about ^, not 0 -- there is a difference
  between 0 and ^.  ^ refers to left-most non-blank.
 
  --Suresh

Reply | Threaded
Open this post in threaded view
|

RE: Visual Block: $ vs. ^ inconsistency?

Gerald Lai-2
On Fri, 19 May 2006, Suresh Govindachar wrote:

>
>   James Vega wrote:
>  > On Fri, May 19, 2006 at 07:47:41AM -0700, Suresh Govindachar wrote:
>  >
>  >>   In visual block mode (<C-V>) one can get jagged
>  >>   right edges by hitting $.  But hitting ^ does not
>  >>   result in jagged left edges.  Why the inconsistency?
>  >>   Is it something in my set-up?
>  >
>  > The leftmost column of a line is always 0.
>
>  I was asking about ^, not 0 -- there is a difference
>  between 0 and ^.  ^ refers to left-most non-blank.

That's an interesting idea, Suresh. I'd like to see what happens then
when I do

   gg<C-v>^o$G

--
Gerald
Reply | Threaded
Open this post in threaded view
|

Re: Visual Block: $ vs. ^ inconsistency?

Matthew Winn
In reply to this post by Suresh Govindachar`
On Fri, May 19, 2006 at 07:47:41AM -0700, Suresh Govindachar wrote:
>   In visual block mode (<C-V>) one can get jagged
>   right edges by hitting $.  But hitting ^ does not
>   result in jagged left edges.  Why the inconsistency?
>   Is it something in my set-up?

It's probably inconsistent because nobody's ever asked for ragged-left
selection.  When lines are ragged-left there's usually significance in
the level of indentation, and in the rare cases where that indentation
is not needed it's trivial to remove so there's nothing that ragged-left
selection could achieve that can't already be done.  In contrast, ragged-
right selection is necessary in order to do block selection of the end
of a set of lines when the longest line is in the middle of the block.

--
Matthew Winn ([hidden email])