Re: Column Selection

2006-05-12 Thread Edward Wong

This is cool tip!  Thanks Hari and Gerald.   :)

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

On Thu, 11 May 2006, Hari Krishna Dara wrote:


 On Thu, 11 May 2006 at 7:57pm, Gerald Lai wrote:

 On Thu, 11 May 2006, Hari Krishna Dara wrote:


 On Thu, 11 May 2006 at 6:37pm, Gerald Lai wrote:

 On Thu, 11 May 2006, Suresh Govindachar wrote:


   Elias Chatzigeorgiou wrote:

 I use the mswin behaviour and insert mode for editing
 (source mswin.vim and set insertmode in _vimrc )

 To enable column selection I use the sequence:
 CTRL-O, g, CTRL-H and hold the SHIFT during the selection.

 Is it possible to simplify the above key sequence? Ideally I
 would like the cream-for-vim equivalent (ALT-SHIFT
 to enable column selection) - but I don't like ice-cream-s :-)

  Try creating the following insert-mode map:

   :imap A-c c-ogc-h

  and then using the sequence Alt-c and hold SHIFT etc.  If you
  like it, place imap A-c c-ogc-h in your vimrc file.

  --Suresh


 I have these mappings in my vimrc that do a Visual Block mousedrag. It
 was a simple modification to make it a Select Block. Place in vimrc.

nnoremap A-S-LeftMouse   mzLeftMouseC-vg`zoC-g
inoremap A-S-LeftMouse
 EscC-vg`^mzEscgiLeftMouseC-oC-vg`zoC-g
vnoremap A-S-LeftDragLeftDrag
vnoremap A-S-LeftMouse   C-vLeftMousemzgvg`zC-g

 Holding down Alt-Shift and click-dragging with the left mouse button in
 any mode should start Select Block mode.

 HTH :)
 --
 Gerald

 I created a tip about this long back:
 http://www.vim.org/tips/tip.php?tip_id=743

 --
 Thanks,
 Hari

 Yes, I remember being inspired by this tip to write the version I have
 now :)

 As the tip suggests, I didn't really want the first click to move the
 cursor and then start the Visual Block mode. I wanted a Visual Block
 highlighted from the cursor's original position to its destination upon
 the first click.

 Then I extended it so that it would work in Insert mode. This was tricky
 to get the Insert cursor positioning correct all the time.

 Very clever. I failed to see what you were doing on the first glance. I
 updated the tip with your version, hope you don't mind.

 --
 Thanks,
 Hari

Not at all :) Thanks Hari!
--
Gerald




--
Ed


RE: Column Selection

2006-05-12 Thread Suresh Govindachar
 

  Elias Chatzigeorgiou indicates that while he can 
  imap c-p as follows:

  imap C-p c-ogc-h

  he is unable to imap a-c

  What is the result of doing
 
  :verbose imap a-c

  If that doesn't give a clue, it might be something 
  with your keyboard.

  --Suresh



[Fwd: Re: Column Selection]

2006-05-12 Thread Elias Chatzigeorgiou

I am using gVim 6.4 (on a Windoze platform).

Is there any way to define ALT-anyting mappings on that platform?

The result of 
:verbose imap a-c


is
i  # C-OgC-H  

where # is a non-english symbol (actually the greek keyboard equivalent 
of c - the greek letter gamma - note that I am Greek, so I have also 
installed greek keyboard/fonts support).


Come on gurus, I am sure you have a workaround for my case  :-) 


Suresh Govindachar wrote:




 Elias Chatzigeorgiou indicates that while he can 
 imap c-p as follows:


 imap C-p c-ogc-h

 he is unable to imap a-c

 What is the result of doing

 :verbose imap a-c


 If that doesn't give a clue, it might be something 
 with your keyboard.


 --Suresh


 





RE: Column Selection

2006-05-11 Thread Gerald Lai

On Thu, 11 May 2006, Suresh Govindachar wrote:



  Elias Chatzigeorgiou wrote:

  I use the mswin behaviour and insert mode for editing
  (source mswin.vim and set insertmode in _vimrc )
 
  To enable column selection I use the sequence:
  CTRL-O, g, CTRL-H and hold the SHIFT during the selection.
 
  Is it possible to simplify the above key sequence? Ideally I
  would like the cream-for-vim equivalent (ALT-SHIFT
  to enable column selection) - but I don't like ice-cream-s :-)

 Try creating the following insert-mode map:

  :imap A-c c-ogc-h

 and then using the sequence Alt-c and hold SHIFT etc.  If you
 like it, place imap A-c c-ogc-h in your vimrc file.

 --Suresh



I have these mappings in my vimrc that do a Visual Block mousedrag. It
was a simple modification to make it a Select Block. Place in vimrc.

  nnoremap A-S-LeftMouse   mzLeftMouseC-vg`zoC-g
  inoremap A-S-LeftMouse   
EscC-vg`^mzEscgiLeftMouseC-oC-vg`zoC-g
  vnoremap A-S-LeftDragLeftDrag
  vnoremap A-S-LeftMouse   C-vLeftMousemzgvg`zC-g

Holding down Alt-Shift and click-dragging with the left mouse button in
any mode should start Select Block mode.

HTH :)
--
Gerald


RE: Column Selection

2006-05-11 Thread Hari Krishna Dara

On Thu, 11 May 2006 at 6:37pm, Gerald Lai wrote:

 On Thu, 11 May 2006, Suresh Govindachar wrote:

 
Elias Chatzigeorgiou wrote:
 
I use the mswin behaviour and insert mode for editing
(source mswin.vim and set insertmode in _vimrc )
   
To enable column selection I use the sequence:
CTRL-O, g, CTRL-H and hold the SHIFT during the selection.
   
Is it possible to simplify the above key sequence? Ideally I
would like the cream-for-vim equivalent (ALT-SHIFT
to enable column selection) - but I don't like ice-cream-s :-)
 
   Try creating the following insert-mode map:
 
:imap A-c c-ogc-h
 
   and then using the sequence Alt-c and hold SHIFT etc.  If you
   like it, place imap A-c c-ogc-h in your vimrc file.
 
   --Suresh
 

 I have these mappings in my vimrc that do a Visual Block mousedrag. It
 was a simple modification to make it a Select Block. Place in vimrc.

nnoremap A-S-LeftMouse   mzLeftMouseC-vg`zoC-g
inoremap A-S-LeftMouse  
EscC-vg`^mzEscgiLeftMouseC-oC-vg`zoC-g
vnoremap A-S-LeftDragLeftDrag
vnoremap A-S-LeftMouse   C-vLeftMousemzgvg`zC-g

 Holding down Alt-Shift and click-dragging with the left mouse button in
 any mode should start Select Block mode.

 HTH :)
 --
 Gerald

I created a tip about this long back:
http://www.vim.org/tips/tip.php?tip_id=743

-- 
Thanks,
Hari

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


RE: Column Selection

2006-05-11 Thread Gerald Lai

On Thu, 11 May 2006, Hari Krishna Dara wrote:



On Thu, 11 May 2006 at 6:37pm, Gerald Lai wrote:


On Thu, 11 May 2006, Suresh Govindachar wrote:



  Elias Chatzigeorgiou wrote:

 I use the mswin behaviour and insert mode for editing
 (source mswin.vim and set insertmode in _vimrc )

 To enable column selection I use the sequence:
 CTRL-O, g, CTRL-H and hold the SHIFT during the selection.

 Is it possible to simplify the above key sequence? Ideally I
 would like the cream-for-vim equivalent (ALT-SHIFT
 to enable column selection) - but I don't like ice-cream-s :-)

 Try creating the following insert-mode map:

  :imap A-c c-ogc-h

 and then using the sequence Alt-c and hold SHIFT etc.  If you
 like it, place imap A-c c-ogc-h in your vimrc file.

 --Suresh



I have these mappings in my vimrc that do a Visual Block mousedrag. It
was a simple modification to make it a Select Block. Place in vimrc.

   nnoremap A-S-LeftMouse   mzLeftMouseC-vg`zoC-g
   inoremap A-S-LeftMouse   
EscC-vg`^mzEscgiLeftMouseC-oC-vg`zoC-g
   vnoremap A-S-LeftDragLeftDrag
   vnoremap A-S-LeftMouse   C-vLeftMousemzgvg`zC-g

Holding down Alt-Shift and click-dragging with the left mouse button in
any mode should start Select Block mode.

HTH :)
--
Gerald


I created a tip about this long back:
http://www.vim.org/tips/tip.php?tip_id=743

--
Thanks,
Hari


Yes, I remember being inspired by this tip to write the version I have
now :)

As the tip suggests, I didn't really want the first click to move the
cursor and then start the Visual Block mode. I wanted a Visual Block
highlighted from the cursor's original position to its destination upon
the first click.

Then I extended it so that it would work in Insert mode. This was tricky
to get the Insert cursor positioning correct all the time.

--
Gerald