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