Thursday, September 24, 2015

Re: visincr and mswin not compatible

On Thu, Sep 24, 2015 at 2:09 PM, John Beckett <johnb.beckett@gmail.com> wrote:
> jordi_frei wrote:
>> The thing is that, I really need to use cntrl-C, cntrl-V
>
> Do not source mwwin.vim and do not use 'behave mswin'.
> Instead, put the following in your _vimrc.
>
> " Select all, cut, copy, paste.
> nnoremap <C-A> ggVG
> vnoremap <C-X> "+x
> vnoremap <C-C> "+y
> nnoremap <C-V> "+gP
> cnoremap <C-V> <C-R>+
> exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
> exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
>
> " Save.
> nnoremap <C-S> :update<CR>
>
> " Increment/decrement (tip 30).
> nnoremap <A-a> <C-a>
> nnoremap <A-x> <C-x>
>
> Save/Increment/decrement are useful, so included above.
>
> Use ':help autoload' to see how paste#paste_cmd works. It
> invokes vim74/autoload/paste.vim for the insert mode and
> visual mode mappings.
>
> John

The :behave command is probably not harmful (less that sourcing
mswin.vim anyway) but for fine control I recommend setting these 4
options individually, each one to your liking, rather than all of them
together. What I use is the following (of course, YMMV):

" :behave tonymec
if exists('+selectmode')
set slm=mouse,key
endif
if exists('+mousemodel')
set mousemodel=popup
endif
if exists('+keymodel')
set keymodel=startsel
endif
if exists('+selection')
set selection=inclusive
endif

As you can see, these settings share some properties of both ":behave
mswin" and ":behave xterm". The ":if" wrappers are to avoid errors
regardless of which features have been compiled-in. They admittedly
have the side-effect that all four of these options are left at their
defaults (if any) in Vim executables compiled with -eval (i.e. in Tiny
and Small builds).


Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: