Mercurial > vim
annotate runtime/mswin.vim @ 24370:7ba92a32a607
Added tag v8.2.2725 for changeset a97fb00978f6c23bf6a926aad38ab2f4c286901d
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 05 Apr 2021 22:45:28 +0200 |
parents | bc1a8d21c811 |
children | 4027cefc2aab |
rev | line source |
---|---|
7 | 1 " Set options and add mapping such that Vim behaves a lot like MS-Windows |
2 " | |
3 " Maintainer: Bram Moolenaar <Bram@vim.org> | |
15131 | 4 " Last Change: 2018 Dec 07 |
21 | 5 |
15131 | 6 " Bail out if this isn't wanted. |
21 | 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 | |
10863
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
26 if has("clipboard") |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
27 " CTRL-X and SHIFT-Del are Cut |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
28 vnoremap <C-X> "+x |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
29 vnoremap <S-Del> "+x |
7 | 30 |
10863
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
31 " CTRL-C and CTRL-Insert are Copy |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
32 vnoremap <C-C> "+y |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
33 vnoremap <C-Insert> "+y |
7 | 34 |
10863
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
35 " CTRL-V and SHIFT-Insert are Paste |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
36 map <C-V> "+gP |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
37 map <S-Insert> "+gP |
7 | 38 |
10863
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
39 cmap <C-V> <C-R>+ |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
40 cmap <S-Insert> <C-R>+ |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
41 endif |
7 | 42 |
43 " Pasting blockwise and linewise selections is not possible in Insert and | |
44 " Visual mode without the +virtualedit feature. They are pasted as if they | |
45 " were characterwise instead. | |
720 | 46 " Uses the paste.vim autoload script. |
3682 | 47 " Use CTRL-G u to have CTRL-Z only undo the paste. |
720 | 48 |
10863
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
49 if 1 |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
50 exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i'] |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
51 exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v'] |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
52 endif |
720 | 53 |
7 | 54 imap <S-Insert> <C-V> |
55 vmap <S-Insert> <C-V> | |
56 | |
57 " Use CTRL-Q to do what CTRL-V used to do | |
58 noremap <C-Q> <C-V> | |
59 | |
14372 | 60 " Use CTRL-S for saving, also in Insert mode (<C-O> doesn't work well when |
61 " using completions). | |
7 | 62 noremap <C-S> :update<CR> |
63 vnoremap <C-S> <C-C>:update<CR> | |
14372 | 64 inoremap <C-S> <Esc>:update<CR>gi |
7 | 65 |
66 " For CTRL-V to work autoselect must be off. | |
67 " On Unix we have two selections, autoselect can be used. | |
68 if !has("unix") | |
69 set guioptions-=a | |
70 endif | |
71 | |
72 " CTRL-Z is Undo; not in cmdline though | |
73 noremap <C-Z> u | |
74 inoremap <C-Z> <C-O>u | |
75 | |
76 " CTRL-Y is Redo (although not repeat); not in cmdline though | |
77 noremap <C-Y> <C-R> | |
78 inoremap <C-Y> <C-O><C-R> | |
79 | |
80 " Alt-Space is System menu | |
81 if has("gui") | |
82 noremap <M-Space> :simalt ~<CR> | |
83 inoremap <M-Space> <C-O>:simalt ~<CR> | |
84 cnoremap <M-Space> <C-C>:simalt ~<CR> | |
85 endif | |
86 | |
87 " CTRL-A is Select all | |
88 noremap <C-A> gggH<C-O>G | |
89 inoremap <C-A> <C-O>gg<C-O>gH<C-O>G | |
90 cnoremap <C-A> <C-C>gggH<C-O>G | |
816 | 91 onoremap <C-A> <C-C>gggH<C-O>G |
819 | 92 snoremap <C-A> <C-C>gggH<C-O>G |
93 xnoremap <C-A> <C-C>ggVG | |
7 | 94 |
95 " CTRL-Tab is Next window | |
96 noremap <C-Tab> <C-W>w | |
97 inoremap <C-Tab> <C-O><C-W>w | |
98 cnoremap <C-Tab> <C-C><C-W>w | |
816 | 99 onoremap <C-Tab> <C-C><C-W>w |
7 | 100 |
101 " CTRL-F4 is Close window | |
102 noremap <C-F4> <C-W>c | |
103 inoremap <C-F4> <C-O><C-W>c | |
104 cnoremap <C-F4> <C-C><C-W>c | |
816 | 105 onoremap <C-F4> <C-C><C-W>c |
7 | 106 |
10863
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
107 if has("gui") |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
108 " CTRL-F is the search dialog |
12708
77960063e2e7
patch 8.0.1232: MS-Windows users are confused about default mappings
Christian Brabandt <cb@256bit.org>
parents:
10863
diff
changeset
|
109 noremap <expr> <C-F> has("gui_running") ? ":promptfind\<CR>" : "/" |
77960063e2e7
patch 8.0.1232: MS-Windows users are confused about default mappings
Christian Brabandt <cb@256bit.org>
parents:
10863
diff
changeset
|
110 inoremap <expr> <C-F> has("gui_running") ? "\<C-\>\<C-O>:promptfind\<CR>" : "\<C-\>\<C-O>/" |
77960063e2e7
patch 8.0.1232: MS-Windows users are confused about default mappings
Christian Brabandt <cb@256bit.org>
parents:
10863
diff
changeset
|
111 cnoremap <expr> <C-F> has("gui_running") ? "\<C-\>\<C-C>:promptfind\<CR>" : "\<C-\>\<C-O>/" |
10863
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
112 |
12708
77960063e2e7
patch 8.0.1232: MS-Windows users are confused about default mappings
Christian Brabandt <cb@256bit.org>
parents:
10863
diff
changeset
|
113 " CTRL-H is the replace dialog, |
77960063e2e7
patch 8.0.1232: MS-Windows users are confused about default mappings
Christian Brabandt <cb@256bit.org>
parents:
10863
diff
changeset
|
114 " but in console, it might be backspace, so don't map it there |
77960063e2e7
patch 8.0.1232: MS-Windows users are confused about default mappings
Christian Brabandt <cb@256bit.org>
parents:
10863
diff
changeset
|
115 nnoremap <expr> <C-H> has("gui_running") ? ":promptrepl\<CR>" : "\<C-H>" |
77960063e2e7
patch 8.0.1232: MS-Windows users are confused about default mappings
Christian Brabandt <cb@256bit.org>
parents:
10863
diff
changeset
|
116 inoremap <expr> <C-H> has("gui_running") ? "\<C-\>\<C-O>:promptrepl\<CR>" : "\<C-H>" |
77960063e2e7
patch 8.0.1232: MS-Windows users are confused about default mappings
Christian Brabandt <cb@256bit.org>
parents:
10863
diff
changeset
|
117 cnoremap <expr> <C-H> has("gui_running") ? "\<C-\>\<C-C>:promptrepl\<CR>" : "\<C-H>" |
10863
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
118 endif |
9130644aec5c
patch 8.0.0321: errors when trying to use scripts in tiny version
Christian Brabandt <cb@256bit.org>
parents:
3713
diff
changeset
|
119 |
7 | 120 " restore 'cpoptions' |
121 set cpo& | |
122 if 1 | |
123 let &cpoptions = s:save_cpo | |
124 unlet s:save_cpo | |
125 endif |