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> viwo<C-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> viwo<C-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