blob: ab358d288457e23089293b7b8dd21548dde45346 [file] [log] [blame]
Christian Brabandtb4ddc6c2024-01-02 16:51:11 +01001*version4.txt* For Vim version 9.1. Last change: 2006 Apr 24
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
3
4 VIM REFERENCE MANUAL by Bram Moolenaar
5
6
7This document lists the incompatible differences between Vim 3.0 and Vim 4.0.
8Although 4.0 is mentioned here, this is also for version 4.1, 4.2, etc..
9
10This file is important for everybody upgrading from Vim 3.0. Read it
11carefully to avoid unexpected problems.
12
13'backup' option default changed |backup-changed|
14Extension for backup file changed |backup-extension|
15Structure of swap file changed |swapfile-changed|
16"-w scriptout" argument changed |scriptout-changed|
17Backspace and Delete keys |backspace-delete|
18Escape for | changed |escape-bar|
19Key codes changed |key-codes-changed|
20Terminal options changed |termcap-changed|
21'errorformat' option changed |errorformat-changed|
22'graphic' option gone |graphic-option-gone|
23'yankendofline' option gone |ye-option-gone|
24'icon' and 'title' default value changed |icon-changed|
25'highlight' option changed |highlight-changed|
26'tildeop' and 'weirdinvert' short names changed |short-name-changed|
27Use of "v", "V" and "CTRL-V" in Visual mode |use-visual-cmds|
28CTRL-B in Insert mode removed |toggle-revins|
29
30
31'backup' option default changed *backup-changed*
32-------------------------------
33
34The default value for 'backup' used to be on. This resulted in a backup file
35being made when the original file was overwritten.
36
37Now the default for 'backup' is off. As soon as the writing of the file has
38successfully finished, the backup file is deleted. If you want to keep the
39backup file, set 'backup' on in your vimrc. The reason for this change is
40that many people complained that leaving a backup file behind is not
41Vi-compatible. |'backup'|
42
43
44Extension for backup file changed *backup-extension*
45---------------------------------
46
47The extension for the backup file used to be ".bak". Since other programs
48also use this extension and some users make copies with this extension, it was
49changed to the less obvious "~". Another advantage is that this takes less
50space, which is useful when working on a system with short file names. For
51example, on MS-DOS the backup files for "longfile.c" and "longfile.h" would
52both become "longfile.bak"; now they will be "longfile.c~" and "longfile.h~".
53
54If you prefer to use ".bak", you can set the 'backupext' option: >
55 :set bex=.bak
56
57
58Structure of swap file changed *swapfile-changed*
59------------------------------
60
61The contents of the swap file were extended with several parameters. Vim
62stores the user name and other information about the edited file to make
63recovery more easy and to be able to know where the swap file comes from. The
64first part of the swap file can now be understood on a machine with a
65different byte order or sizeof(int). When you try to recover a file on such a
66machine, you will get an error message that this is not possible.
67
68Because of this change, swap files cannot be exchanged between 3.0 and 4.0.
69If you have a swap file from a crashed session with 3.0, use Vim 3.0 to
70recover the file---don't use 4.0. |swap-file|
71
72
73"-w scriptout" argument changed *scriptout-changed*
74-------------------------------
75
76"vim -w scriptout" used to append to the scriptout file. Since this was
77illogical, it now creates a new file. An existing file is not overwritten
78(to avoid destroying an existing file for those who rely on the appending).
79[This was removed again later] |-w|
80
81
82Backspace and Delete keys *backspace-delete*
83-------------------------
84
85In 3.0 both the delete key and the backspace key worked as a backspace in
86insert mode; they deleted the character to the left of the cursor. In 4.0 the
87delete key has a new function: it deletes the character under the cursor, just
88like it does on the command-line. If the cursor is after the end of the line
89and 'bs' is set, two lines are joined. |<Del>| |i_<Del>|
90
91In 3.0 the backspace key was always defined as CTRL-H and delete as CTRL-?.
92In 4.0 the code for the backspace and delete key is obtained from termcap or
93termlib, and adjusted for the "stty erase" value on Unix. This helps people
94who define the erase character according to the keyboard they are working on.
95 |<BS>| |i_<BS>|
96
97If you prefer backspace and delete in Insert mode to have the old behavior,
98put this line in your vimrc:
99
100 inoremap ^? ^H
101
102And you may also want to add these, to fix the values for <BS> and <Del>:
103
104 set t_kb=^H
105 set t_kD=^?
106
107(Enter ^H with CTRL-V CTRL-H and ^? with CTRL-V CTRL-? or <Del>.)
108
109If the value for t_kb is correct, but the t_kD value is not, use the ":fixdel"
110command. It will set t_kD according to the value of t_kb. This is useful if
111you are using several different terminals. |:fixdel|
112
113When ^H is not recognized as <BS> or <Del>, it is used like a backspace.
114
115
116Escape for | changed *escape-bar*
117--------------------
118
119When the 'b' flag is present in 'cpoptions', the backslash cannot be used to
120escape '|' in mapping and abbreviate commands, only CTRL-V can. This is
121Vi-compatible. If you work in Vi-compatible mode and had used "\|" to include
122a bar in a mapping, this needs to be replaced by "^V|". See |:bar|.
123
124
125Key codes changed *key-codes-changed*
126-----------------
127
128The internal representation of key codes has changed dramatically. In 3.0 a
129one-byte code was used to represent a key. This caused problems with
130different characters sets that also used these codes. In 4.0 a three-byte
131code is used that cannot be confused with a character. |key-notation|
132
133If you have used the single-byte key codes in your vimrc for mappings, you
134will have to replace them with the 4.0 codes. Instead of using the three-byte
135code directly, you should use the symbolic representation for this in <>. See
136the table below. The table also lists the old name, as it was used in the 3.0
137documentation.
138
139The key names in <> can be used in mappings directly. This makes it possible
140to copy/paste examples or type them literally. The <> notation has been
141introduced for this |<>|. The 'B' and '<' flags must not be present in
142'cpoptions' to enable this to work |'cpoptions'|.
143
144old name new name old code old MS-DOS code ~
145 hex dec hex dec ~
146<ESC> <Esc>
147<TAB> <Tab>
148<LF> <NL> <NewLine> <LineFeed>
149<SPACE> <Space>
150<NUL> <Nul>
151<BELL> <Bell>
152<BS> <BS> <BackSpace>
153<INSERT> <Insert>
154<DEL> <Del> <Delete>
155<HOME> <Home>
156<END> <End>
157<PAGE_UP> <PageUp>
158<PAGE_DOWN> <PageDown>
159
160<C_UP> <Up> 0x80 128 0xb0 176
161<C_DOWN> <Down> 0x81 129 0xb1 177
162<C_LEFT> <Left> 0x82 130 0xb2 178
163<C_RIGHT> <Right> 0x83 131 0xb3 179
164<SC_UP> <S-Up> 0x84 132 0xb4 180
165<SC_DOWN> <S-Down> 0x85 133 0xb5 181
166<SC_LEFT> <S-Left> 0x86 134 0xb6 182
167<SC_RIGHT> <S-Right> 0x87 135 0xb7 183
168
169<F1> <F1> 0x88 136 0xb8 184
170<F2> <F2> 0x89 137 0xb9 185
171<F3> <F3> 0x8a 138 0xba 186
172<F4> <F4> 0x8b 139 0xbb 187
173<F5> <F5> 0x8c 140 0xbc 188
174<F6> <F6> 0x8d 141 0xbd 189
175<F7> <F7> 0x8e 142 0xbe 190
176<F8> <F8> 0x8f 143 0xbf 191
177<F9> <F9> 0x90 144 0xc0 192
178<F10> <F10> 0x91 145 0xc1 193
179
180<SF1> <S-F1> 0x92 146 0xc2 194
181<SF2> <S-F2> 0x93 147 0xc3 195
182<SF3> <S-F3> 0x94 148 0xc4 196
183<SF4> <S-F4> 0x95 149 0xc5 197
184<SF5> <S-F5> 0x96 150 0xc6 198
185<SF6> <S-F6> 0x97 151 0xc7 199
186<SF7> <S-F7> 0x98 152 0xc8 200
187<SF8> <S-F8> 0x99 153 0xc9 201
188<SF9> <S-F9> 0x9a 154 0xca 202
189<SF10> <S-F10> 0x9b 155 0xcb 203
190
191<HELP> <Help> 0x9c 156 0xcc 204
192<UNDO> <Undo> 0x9d 157 0xcd 205
193
194 (not used) 0x9e 158 0xce 206
195 (not used) 0x9f 159 0xcf 207
196
197
198Terminal options changed *termcap-changed*
199------------------------
200
201The names of the terminal options have been changed to match the termcap names
202of these options. All terminal options now have the name t_xx, where xx is
203the termcap name. Normally these options are not used, unless you have a
204termcap entry that is wrong or incomplete, or you have set the highlight
205options to a different value. |terminal-options|
206
207Note that for some keys there is no termcap name. Use the <> type of name
208instead, which is a good idea anyway.
209
210Note that "t_ti" has become "t_mr" (invert/reverse output) and "t_ts" has
211become "t_ti" (init terminal mode). Be careful when you use "t_ti"!
212
213old name new name meaning ~
214t_cdl t_DL delete number of lines *t_cdl*
215t_ci t_vi cursor invisible *t_ci*
216t_cil t_AL insert number of lines *t_cil*
217t_cm t_cm move cursor
218t_cri t_RI cursor number of chars right *t_cri*
219t_cv t_ve cursor visible *t_cv*
220t_cvv t_vs cursor very visible *t_cvv*
221t_dl t_dl delete line
222t_cs t_cs scroll region
223t_ed t_cl clear display *t_ed*
224t_el t_ce clear line *t_el*
225t_il t_al insert line *t_il*
226 t_da display may be retained above the screen
227 t_db display may be retained below the screen
228t_ke t_ke put terminal out of keypad transmit mode
229t_ks t_ks put terminal in keypad transmit mode
230t_ms t_ms save to move cursor in highlight mode
231t_se t_se normal mode (undo t_so)
232t_so t_so shift out (standout) mode
233t_ti t_mr reverse highlight
234t_tb t_md bold mode *t_tb*
235t_tp t_me highlight end *t_tp*
236t_sr t_sr scroll reverse
237t_te t_te out of termcap mode
238t_ts t_ti into termcap mode *t_ts_old*
239t_vb t_vb visual bell
240t_csc t_CS cursor is relative to scroll region *t_csc*
241
242t_ku t_ku <Up> arrow up
243t_kd t_kd <Down> arrow down
244t_kr t_kr <Right> arrow right
245t_kl t_kl <Left> arrow left
246t_sku <S-Up> shifted arrow up *t_sku*
247t_skd <S-Down> shifted arrow down *t_skd*
248t_skr t_%i <S-Right> shifted arrow right *t_skr*
249t_skl t_#4 <S-Left> shifted arrow left *t_skl*
250t_f1 t_k1 <F1> function key 1 *t_f1*
251t_f2 t_k2 <F2> function key 2 *t_f2*
252t_f3 t_k3 <F3> function key 3 *t_f3*
253t_f4 t_k4 <F4> function key 4 *t_f4*
254t_f5 t_k5 <F5> function key 5 *t_f5*
255t_f6 t_k6 <F6> function key 6 *t_f6*
256t_f7 t_k7 <F7> function key 7 *t_f7*
257t_f8 t_k8 <F8> function key 8 *t_f8*
258t_f9 t_k9 <F9> function key 9 *t_f9*
259t_f10 t_k; <F10> function key 10 *t_f10*
260t_sf1 <S-F1> shifted function key 1 *t_sf1*
261t_sf2 <S-F2> shifted function key 2 *t_sf2*
262t_sf3 <S-F3> shifted function key 3 *t_sf3*
263t_sf4 <S-F4> shifted function key 4 *t_sf4*
264t_sf5 <S-F5> shifted function key 5 *t_sf5*
265t_sf6 <S-F6> shifted function key 6 *t_sf6*
266t_sf7 <S-F7> shifted function key 7 *t_sf7*
267t_sf8 <S-F8> shifted function key 8 *t_sf8*
268t_sf9 <S-F9> shifted function key 9 *t_sf9*
269t_sf10 <S-F10> shifted function key 10 *t_sf10*
270t_help t_%1 <Help> help key *t_help*
271t_undo t_&8 <Undo> undo key *t_undo*
272
273
274'errorformat' option changed *errorformat-changed*
275----------------------------
276
277'errorformat' can now contain several formats, separated by commas. The first
278format that matches is used. The default values have been adjusted to catch
279the most common formats. |errorformat|
280
281If you have a format that contains a comma, it needs to be preceded with a
282backslash. Type two backslashes, because the ":set" command will eat one.
283
284
285'graphic' option gone *graphic-option-gone*
286---------------------
287
288The 'graphic' option was used to make the characters between <~> and 0xa0
289display directly on the screen. Now the 'isprint' option takes care of this
290with many more possibilities. The default setting is the same; you only need
291to look into this if you previously set the 'graphic' option in your vimrc.
292 |'isprint'|
293
294
295'yankendofline' option gone *ye-option-gone*
296---------------------------
297
298The 'yankendofline' option has been removed. Instead you can just use
299 :map Y y$
300
301
302'icon' and 'title' default value changed *icon-changed*
303----------------------------------------
304
305The 'title' option is now only set by default if the original title can be
306restored. Avoids "Thanks for flying Vim" titles. If you want them anyway,
307put ":set title" in your vimrc. |'title'|
308
309The default for 'icon' now depends on the possibility of restoring the
310original value, just like 'title'. If you don't like your icon titles to be
311changed, add this line to your vimrc: |'icon'|
312 :set noicon
313
314
315'highlight' option changed *highlight-changed*
316--------------------------
317
318The 'i' flag now means italic highlighting, instead of invert. The 'r' flag
319is used for reverse highlighting, which is what 'i' used to be. Normally you
320won't see the difference, because italic mode is not supported on most
321terminals and reverse mode is used as a fallback. |'highlight'|
322
323When an occasion is not present in 'highlight', use the mode from the default
324value for 'highlight', instead of reverse mode.
325
326
327'tildeop' and 'weirdinvert' short names changed *short-name-changed*
328-----------------------------------------------
329
330Renamed 'to' (abbreviation for 'tildeop') to 'top'. |'tildeop'|
331Renamed 'wi' (abbreviation for 'weirdinvert') to 'wiv'. |'weirdinvert'|
332
333This was done because Vi uses 'wi' as the short name for 'window' and 'to' as
334the short name for 'timeout'. This means that if you try setting these
335options, you won't get an error message, but the effect will be different.
336
337
338Use of "v", "V" and "CTRL-V" in Visual mode *use-visual-cmds*
339-------------------------------------------
340
341In Visual mode, "v", "V", and "CTRL-V" used to end Visual mode. Now this
342happens only if the Visual mode was in the corresponding type. Otherwise the
343type of Visual mode is changed. Now only ESC can be used in all circumstances
344to end Visual mode without doing anything. |v_V|
345
346
347CTRL-B in Insert mode removed *toggle-revins*
348-----------------------------
349
350CTRL-B in Insert mode used to toggle the 'revins' option. If you don't know
351this and accidentally hit CTRL-B, it is very difficult to find out how to undo
352it. Since hardly anybody uses this feature, it is disabled by default. If
353you want to use it, define RIGHTLEFT in feature.h before compiling. |'revins'|
354
Bram Moolenaard473c8c2018-08-11 18:00:22 +0200355 vim:tw=78:ts=8:noet:ft=help:norl: