Re: right-to-left text selection

2006-05-21 Thread Jared
On 5/20/2006 7:21 PM, Gerald Lai wrote:
 Hi, Gerald.  Thanks for the reply.  This is a pretty creative suggestion,
 but I can't get it to work quite right.  I tried adding this to my
 .vimrc:

 nnoremap 2-LeftMouse viwoC-g
 vnoremap 2-LeftDrag  LeftDrag
 
 Yes, Vim should recognize the 2-LeftDrag event. I verified your
 problem and found out what happened :)
 
 Stripping down my mappings led me to the solution. Add this extra
 mapping:
 
   nnoremap LeftRelease Nop

That did it!  Thanks again for the help, Gerald.  With this I'm finally able
to mark the last thing of my vimrc todo list.  :-)

--
Jared


Re: right-to-left text selection

2006-05-20 Thread Gerald Lai

On Sat, 20 May 2006, Jared wrote:


On 5/18/2006 1:52 AM, Gerald Lai wrote:

On Tue, 16 May 2006, Gerald Lai wrote:
I just thought of another more pleasing workaround, if you're
interested. Try:

  nnoremap 2-LeftMouse viwo
  vnoremap 2-LeftDrag  LeftDrag

This way, if you wish to select the last character, start with a double
click instead of a single click (ala include the last character, damn
it!) ;)

If you want it to be in SELECT mode after the double click, then use
this instead:

  nnoremap 2-LeftMouse viwoC-g


Hi, Gerald.  Thanks for the reply.  This is a pretty creative suggestion,
but I can't get it to work quite right.  I tried adding this to my .vimrc:

nnoremap 2-LeftMouse viwoC-g
vnoremap 2-LeftDrag  LeftDrag

What's happening is that the last character will be selected, but I'm unable
to drag without clicking again.  When I click that third time, one of two
things happen:

* I click it fast enough to trigger the triple-click event, which selects
the whole line.
* I click slow enough that the default single-click action kicks in, which
takes me back to my original problem.

The vnoremap line doesn't seem to have any effect.  Does Vim recognize that
2-LeftDrag event?  That seems like it should solve my problem, but Vim
seems to ignore it.


Yes, Vim should recognize the 2-LeftDrag event. I verified your
problem and found out what happened :)

When I tried those mappings on my settings, it works perfectly. When I
started it without my settings (that heavily modified mouse mappings),
it does as you describe.

Stripping down my mappings led me to the solution. Add this extra
mapping:

  nnoremap LeftRelease Nop

It ought to work then with the other 2 mappings, and does not disrupt
anything from what I can tell. Seems that LeftRelease was doing its
job within the double-click.

HTH :)
--
Gerald


Re: right-to-left text selection

2006-05-18 Thread Hari Krishna Dara

On Wed, 17 May 2006 at 11:41pm, Jared wrote:

 On 5/17/2006 11:11 PM, Eric Arnold wrote:
  While the visual mode selection is active, hitting o moves to the
  opposite corner.
 
  SNIP
 
  Keep in mind that it doesn't work the same with a selection made by
  the mouse, since that leaves it in select mode not visual mode,
  which has some properties like insert mode, but in general has to be
  treated differently.  Use ^G to switch visual/select modes.


 Ok, this was the problem.  I was using select mode rather than visual mode,
 and it was behaving exactly as you described.  If I select the text, then
 hit ^gol^c, I can finally select all text, including the last character. 
Yay!

 Not exactly the easiest key sequence, but at least I can make it work now.

 Thanks, Eric!

 --
 Jared

If this worksout for you, try creating a map, something like:

vnoremap F12 C-GolC-C

or even, C-C itself to be:

vnoremap C-C C-GolC-C

You might even be able to map the LeftRelease to do this
automatically, not sure how you have selection mode setup, but if you
give your settings, I can try to get a mapping work for you.

-- 
HTH,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: right-to-left text selection

2006-05-17 Thread Eric Arnold

Use the o command to switch positions of the cursor, and then move
to the left.

On 5/16/06, Gerald Lai [EMAIL PROTECTED] wrote:

On Tue, 16 May 2006, Jared wrote:

[snip]
 So, my question:  is it somehow possible to be able to select the last
 character of a line when selecting from right-to-left while using
 selection=exclusive?
[snip]

The simplest work around is to hit ol (that's oh-el) to select that
last character.

You should know that the behavior of selection=exclusive has been shown
to been inconsistent. IMO, it's better to have selection=inclusive and
work around to removing the newline if it exists.

HTH.
--
Gerald



Re: right-to-left text selection

2006-05-17 Thread Georg Dahn
Hi!

 So, my question:  is it somehow possible to be able to select the
last
 character of a line when selecting from right-to-left while using
 selection=exclusive?

This can be done by doing

:set virtualedit=onemore

which allows the cursor to move just past the end of the line. This
makes exclusive selection much more consistent, but is not compatible
to
Vi. It may break some plugins, so use it with care!

Of course, doing

:set virtualedit=all

helps, too, but this is something, which many people don't like. I
don't
like it and set 'virtualedit' to 'block'. BTW, starting the right-to-
left selection in Insert mode selects the last character, too.

Best wishes,

Georg









Send instant messages to your online friends http://uk.messenger.yahoo.com 


Re: right-to-left text selection

2006-05-17 Thread Eric Arnold

While the visual mode selection is active, hitting o moves to the
opposite corner.  If it isn't doing that for you, I'd check for

vmap

interference.

3. Changing the Visual area *visual-change*

*v_o*
o   Go to Other end of highlighted text: The current
cursor position becomes the start of the highlighted
text and the cursor is moved to the other end of the
highlighted text.  The highlighted area remains the
same.

Keep in mind that it doesn't work the same with a selection made by
the mouse, since that leaves it in select mode not visual mode,
which has some properties like insert mode, but in general has to be
treated differently.  Use ^G to switch visual/select modes.


On 5/17/06, Jared [EMAIL PROTECTED] wrote:

On 5/17/2006 12:52 AM, Gerald Lai wrote:
 So, my question:  is it somehow possible to be able to select the last
 character of a line when selecting from right-to-left while using
 selection=exclusive?

 The simplest work around is to hit ol (that's oh-el) to select that
 last character.

How exactly does this work?  When I hit o in command mode, it adds a newline
below and moves the cursor down.  If I hit o in select mode, it overtypes my
selection.  Hitting l does move the character to the right, but not if it's
on the last line.

Sorry, must've just misunderstood you.  Would you mind explaining again?

Thanks.

--
Jared



Re: right-to-left text selection

2006-05-17 Thread A.J.Mechelynck

Jared wrote:

On 5/17/2006 12:52 AM, Gerald Lai wrote:
  

So, my question:  is it somehow possible to be able to select the last
character of a line when selecting from right-to-left while using
selection=exclusive?
  

The simplest work around is to hit ol (that's oh-el) to select that
last character.



How exactly does this work?  When I hit o in command mode, it adds a newline
below and moves the cursor down.  If I hit o in select mode, it overtypes my
selection.  Hitting l does move the character to the right, but not if it's
on the last line.

Sorry, must've just misunderstood you.  Would you mind explaining again?

Thanks.

--
Jared


  

Try using it in --VISUAL-- (not --SELECT--) mode.

To start Visual mode, hit v (characterwise), V (linewise) or Ctrl-V 
(blockwise) in Normal mode, then move the cursor. (And if you use Ctrl-V 
to paste, use Ctrl-Q instead.)



Best regards,
Tony.


Re: right-to-left text selection

2006-05-17 Thread Jared
On 5/17/2006 11:11 PM, Eric Arnold wrote:
 While the visual mode selection is active, hitting o moves to the
 opposite corner.

 SNIP

 Keep in mind that it doesn't work the same with a selection made by
 the mouse, since that leaves it in select mode not visual mode,
 which has some properties like insert mode, but in general has to be
 treated differently.  Use ^G to switch visual/select modes.


Ok, this was the problem.  I was using select mode rather than visual mode,
and it was behaving exactly as you described.  If I select the text, then
hit ^gol^c, I can finally select all text, including the last character.  Yay!

Not exactly the easiest key sequence, but at least I can make it work now.

Thanks, Eric!

--
Jared


right-to-left text selection

2006-05-16 Thread Jared
Ok, I have a really weird questions this time.  I use the
selection=exclusive option, because I don't like Vim to select the hidden
newline character at the end of lines when I'm copying or deleting an
entire line.  However, this has one side effect that I have not been able to
figure out.  If I try to select a line of text from the right to the left,
it is impossible to select the last character of the line.

Of course, one solution would be to set selection=inclusive, but then the
newline character at the end of the line is always selected when selecting
text from left to right.  I know that sounds pretty trivial, but it's a
major nuisance for my editing style.

So, my question:  is it somehow possible to be able to select the last
character of a line when selecting from right-to-left while using
selection=exclusive?  Alternatively, is there some way to make Vim NOT
select the newline character at the end of the line when selecting text from
left-to-right while using selection=inclusive?  At this point I've tried
quite a few options and I'm thinking it's not, but I'd certainly like to
hear from the pros if they have any suggestions.

Does this even make sense?  Given how many times I used the word select,
probably not.  :-)  Please let me know if this comes across as gibberish and
I'll try to better explain myself.

Thanks!

--
Jared