annotate runtime/mswin.vim @ 200:3585d1a53fa5

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