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-o>g<c-h> > >>> > >>> and then using the sequence <Alt-c> and hold SHIFT etc. If you > >>> like it, place "imap <A-c> <c-o>g<c-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> mz<LeftMouse><C-v>g`zo<C-g> > >> inoremap <A-S-LeftMouse> <Esc><C-v>g`^mz<Esc>gi<LeftMouse><C-o><C-v>g`zo<C-g> > >> vnoremap <A-S-LeftDrag> <LeftDrag> > >> vnoremap <A-S-LeftMouse> <C-v><LeftMouse>mzgvg`z<C-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 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com