"| "| File : ~/.vim/plugin/cua-mode.vim "| Source : https://github.com/fabi1cazenave/cua-mode "| Licence : WTFPL "| "| This file brings Notepad-like CTRL-ZXCV shortcuts to Vim, while preserving "| all other Vim shortcuts -- like the CUA-mode does on Emacs: "| http://www.emacswiki.org/CuaMode "| "| It is based on Bram Molenaar's mswin.vim, g:cua_mode sets the behavior: "| 0. raw "| 1. CUA mode = (default) CTRL-ZXCV -- subset of mswin.vim "| 2. mswin mode = CUA mode + CTRL-ASY -- strict equivalent of mswin.vim "| 3. Notepad mode = mswin mode + CTRL-QOF -- superset of mswin.vim "| " don't load $VIMRUNTIME/mswin.vim let g:skip_loading_mswin=1 " bail out if this isn't wanted (i.e. when g:cua_mode is defined to 0). if !exists('g:cua_mode') let g:cua_mode = 1 elseif g:cua_mode == 0 finish endif " recommended settings: " set nocompatible " required for a multi-level undo/redo stack " set mouse=a " enables mouse selection " set the 'cpoptions' to its Vim default let s:save_cpo = &cpoptions set cpo&vim " behave like xterm when not in GUI mode behave xterm if has('gui_running') set mousemodel=popup_setpos " right-click displays a popup menu set keymodel=startsel,stopsel " shift+arrows triggers the select mode endif " backspace and cursor keys wrap to previous/next line set backspace=indent,eol,start whichwrap+=<,>,[,] " backspace in Visual mode deletes selection vnoremap d " don't mess with CTRL-* shortcuts on MacOSX if has('unix') && (system('uname') =~ '^Darwin') finish endif "| Common PC shortcuts: CTRL-ZXCV <=> Undo|Cut|Copy|Paste <<< "|----------------------------------------------------------------------------- " CTRL-Z is Undo noremap u inoremap u " 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. " Uses the paste.vim autoload script. exe 'inoremap