7
|
1 " Set options and add mapping such that Vim behaves a lot like MS-Windows
|
|
2 "
|
|
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
|
21
|
4 " Last change: 2004 Jul 27
|
|
5
|
|
6 " bail out if this isn't wanted (mrsvim.vim uses this).
|
|
7 if exists("g:skip_loading_mswin") && g:skip_loading_mswin
|
|
8 finish
|
|
9 endif
|
7
|
10
|
|
11 " set the 'cpoptions' to its Vim default
|
|
12 if 1 " only do this when compiled with expression evaluation
|
|
13 let s:save_cpo = &cpoptions
|
|
14 endif
|
|
15 set cpo&vim
|
|
16
|
|
17 " set 'selection', 'selectmode', 'mousemodel' and 'keymodel' for MS-Windows
|
|
18 behave mswin
|
|
19
|
|
20 " backspace and cursor keys wrap to previous/next line
|
|
21 set backspace=indent,eol,start whichwrap+=<,>,[,]
|
|
22
|
|
23 " backspace in Visual mode deletes selection
|
|
24 vnoremap <BS> d
|
|
25
|
|
26 " CTRL-X and SHIFT-Del are Cut
|
|
27 vnoremap <C-X> "+x
|
|
28 vnoremap <S-Del> "+x
|
|
29
|
|
30 " CTRL-C and CTRL-Insert are Copy
|
|
31 vnoremap <C-C> "+y
|
|
32 vnoremap <C-Insert> "+y
|
|
33
|
|
34 " CTRL-V and SHIFT-Insert are Paste
|
|
35 map <C-V> "+gP
|
|
36 map <S-Insert> "+gP
|
|
37
|
|
38 cmap <C-V> <C-R>+
|
|
39 cmap <S-Insert> <C-R>+
|
|
40
|
|
41 " Pasting blockwise and linewise selections is not possible in Insert and
|
|
42 " Visual mode without the +virtualedit feature. They are pasted as if they
|
|
43 " were characterwise instead.
|
|
44 " Note: the same stuff appears in menu.vim.
|
|
45 if has("virtualedit")
|
|
46 nnoremap <silent> <SID>Paste :call <SID>Paste()<CR>
|
|
47 func! <SID>Paste()
|
|
48 let ove = &ve
|
|
49 set ve=all
|
|
50 normal `^
|
|
51 if @+ != ''
|
|
52 normal "+gP
|
|
53 endif
|
|
54 let c = col(".")
|
|
55 normal i
|
|
56 if col(".") < c " compensate for i<ESC> moving the cursor left
|
|
57 normal l
|
|
58 endif
|
|
59 let &ve = ove
|
|
60 endfunc
|
|
61 inoremap <script> <C-V> x<BS><Esc><SID>Pastegi
|
|
62 vnoremap <script> <C-V> "-c<Esc><SID>Paste
|
|
63 else
|
|
64 nnoremap <silent> <SID>Paste "=@+.'xy'<CR>gPFx"_2x
|
|
65 inoremap <script> <C-V> x<Esc><SID>Paste"_s
|
|
66 vnoremap <script> <C-V> "-c<Esc>gix<Esc><SID>Paste"_x
|
|
67 endif
|
|
68 imap <S-Insert> <C-V>
|
|
69 vmap <S-Insert> <C-V>
|
|
70
|
|
71 " Use CTRL-Q to do what CTRL-V used to do
|
|
72 noremap <C-Q> <C-V>
|
|
73
|
|
74 " Use CTRL-S for saving, also in Insert mode
|
|
75 noremap <C-S> :update<CR>
|
|
76 vnoremap <C-S> <C-C>:update<CR>
|
|
77 inoremap <C-S> <C-O>:update<CR>
|
|
78
|
|
79 " For CTRL-V to work autoselect must be off.
|
|
80 " On Unix we have two selections, autoselect can be used.
|
|
81 if !has("unix")
|
|
82 set guioptions-=a
|
|
83 endif
|
|
84
|
|
85 " CTRL-Z is Undo; not in cmdline though
|
|
86 noremap <C-Z> u
|
|
87 inoremap <C-Z> <C-O>u
|
|
88
|
|
89 " CTRL-Y is Redo (although not repeat); not in cmdline though
|
|
90 noremap <C-Y> <C-R>
|
|
91 inoremap <C-Y> <C-O><C-R>
|
|
92
|
|
93 " Alt-Space is System menu
|
|
94 if has("gui")
|
|
95 noremap <M-Space> :simalt ~<CR>
|
|
96 inoremap <M-Space> <C-O>:simalt ~<CR>
|
|
97 cnoremap <M-Space> <C-C>:simalt ~<CR>
|
|
98 endif
|
|
99
|
|
100 " CTRL-A is Select all
|
|
101 noremap <C-A> gggH<C-O>G
|
|
102 inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
|
|
103 cnoremap <C-A> <C-C>gggH<C-O>G
|
|
104
|
|
105 " CTRL-Tab is Next window
|
|
106 noremap <C-Tab> <C-W>w
|
|
107 inoremap <C-Tab> <C-O><C-W>w
|
|
108 cnoremap <C-Tab> <C-C><C-W>w
|
|
109
|
|
110 " CTRL-F4 is Close window
|
|
111 noremap <C-F4> <C-W>c
|
|
112 inoremap <C-F4> <C-O><C-W>c
|
|
113 cnoremap <C-F4> <C-C><C-W>c
|
|
114
|
|
115 " restore 'cpoptions'
|
|
116 set cpo&
|
|
117 if 1
|
|
118 let &cpoptions = s:save_cpo
|
|
119 unlet s:save_cpo
|
|
120 endif
|