" Set options and add mapping such that Vim behaves a lot like MS-Windows " " Maintainer: Bram Moolenaar " Last change: 2002 Mar 05 " set the 'cpoptions' to its Vim default if 1 " only do this when compiled with expression evaluation let s:save_cpo = &cpoptions endif set cpo&vim " set 'selection', 'selectmode', 'mousemodel' and 'keymodel' for MS-Windows behave mswin " backspace and cursor keys wrap to previous/next line set backspace=2 whichwrap+=<,>,[,] " backspace in Visual mode deletes selection vnoremap d " CTRL-X and SHIFT-Del are Cut vnoremap "+x vnoremap "+x " CTRL-C and CTRL-Insert are Copy vnoremap "+y vnoremap "+y " CTRL-V and SHIFT-Insert are Paste map "+gP map "+gP cmap + cmap + " Pasting blockwise and linewise selections is not possible in Insert and " Visual mode without the +virtualedit feature. They are pasted as if they " were characterwise instead. if has("virtualedit") nnoremap Paste :call Paste() func! Paste() let ove = &ve set ve=all normal `^"+gPi let &ve = ove endfunc imap Pastegi vmap "-cPaste else nnoremap Paste "=@+.'xy'gPFx"_2x imap xPaste"_s vmap "-cgixPaste"_x endif imap vmap " Use CTRL-Q to do what CTRL-V used to do noremap " Use CTRL-S for saving, also in Insert mode noremap :update vnoremap :update inoremap :update " For CTRL-V to work autoselect must be off. " On Unix we have two selections, autoselect can be used. if !has("unix") set guioptions-=a endif " CTRL-Z is Undo; not in cmdline though noremap u inoremap u " CTRL-Y is Redo (although not repeat); not in cmdline though noremap inoremap " Alt-Space is System menu if has("gui") noremap :simalt ~ inoremap :simalt ~ cnoremap :simalt ~ endif " CTRL-A is Select all noremap gggHG inoremap gggHG cnoremap gggHG " CTRL-Tab is Next window noremap w inoremap w cnoremap w " CTRL-F4 is Close window noremap c inoremap c cnoremap c " restore 'cpoptions' set cpo& if 1 let &cpoptions = s:save_cpo unlet s:save_cpo endif