*version4.txt* For Vim version 5.4. Last change: 1999 May 02 VIM REFERENCE MANUAL by Bram Moolenaar This document lists the incompatible differences between Vim 3.0 and Vim 4.0. Although 4.0 is mentioned here, this is also for version 4.1, 4.2, etc.. This file is important for everybody upgrading from Vim 3.0. Read it carefully to avoid unexpected problems. 'backup' option default changed |backup-changed| Extension for backup file changed |backup-extension| Structure of swap file changed |swapfile-changed| "-w scriptout" argument changed |scriptout-changed| Backspace and Delete keys |backspace-delete| Escape for | changed |escape-bar| Key codes changed |key-codes-changed| Terminal options changed |termcap-changed| 'errorformat' option changed |errorformat-changed| 'graphic' option gone |graphic-option-gone| 'yankendofline' option gone |ye-option-gone| 'icon' and 'title' default value changed |icon-changed| 'highlight' option changed |highlight-changed| 'tildeop' and 'weirdinvert' short names changed |short-name-changed| Use of "v", "V" and "CTRL-V" in Visual mode |use-visual-cmds| CTRL-B in Insert mode removed |toggle-revins| 'backup' option default changed *backup-changed* The default value for 'backup' used to be on. This resulted in a backup file being made when the original file was overwritten. Now the default for 'backup' is off. As soon as the writing of the file has successfully finished, the backup file is deleted. If you want to keep the backup file, set 'backup' on in your vimrc. The reason for this change is that many people complained that leaving a backup file behind is not Vi-compatible. |'backup'| Extension for backup file changed *backup-extension* The extension for the backup file used to be ".bak". Since other programs also use this extension and some users make copies with this extension, it was changed to the less obvious "~". Another advantage is that this takes less space, which is useful when working on a system with short file names. For example, on MS-DOS the backup files for "longfile.c" and "longfile.h" would both become "longfile.bak"; now they will be "longfile.c~" and "longfile.h~". If you prefer to use ".bak", you can set the 'backupext' option: :set bex=.bak |'backupext'| Structure of swap file changed *swapfile-changed* The contents of the swap file were extended with several parameters. Vim stores the user name and other information about the edited file to make recovery more easy and to be able to know where the swap file comes from. The first part of the swap file can now be understood on a machine with a different byte order or sizeof(int). When you try to recover a file on such a machine, you will get an error message that this is not possible. Because of this change, swap files cannot be exchanged between 3.0 and 4.0. If you have a swap file from a crashed session with 3.0, use Vim 3.0 to recover the file---don't use 4.0. |swap-file| "-w scriptout" argument changed *scriptout-changed* "vim -w scriptout" used to append to the scriptout file. Since this was illogical, it now creates a new file. An existing file is not overwritten (to avoid destroying an existing file for those who rely on the appending). |-w| Backspace and Delete keys *backspace-delete* In 3.0 both the delete key and the backspace key worked as a backspace in insert mode; they deleted the character to the left of the cursor. In 4.0 the delete key has a new function: it deletes the character under the cursor, just like it does on the command-line. If the cursor is after the end of the line and 'bs' is set, two lines are joined. || |i_| In 3.0 the backspace key was always defined as CTRL-H and delete as CTRL-?. In 4.0 the code for the backspace and delete key is obtained from termcap or termlib, and adjusted for the "stty erase" value on Unix. This helps people who define the erase character according to the keyboard they are working on. || |i_| If you prefer backspace and delete in Insert mode to have the old behavior, put this line in your vimrc: inoremap ^? ^H And you may also want to add these, to fix the values for and: set t_kb=^H set t_kD=^? (Enter ^H with CTRL-V CTRL-H and ^? with CTRL-V CTRL-? or.) If the value for t_kb is correct, but the t_kD value is not, use the ":fixdel" command. It will set t_kD according to the value of t_kb. This is useful if you are using several different terminals. |:fixdel| When ^H is not recognized as or, it is used like a backspace. Escape for | changed *escape-bar* When the 'b' flag is present in 'cpoptions', the backslash cannot be used to escape '|' in mapping and abbreviate commands, only CTRL-V can. This is Vi-compatible. If you work in Vi-compatible mode and had used "\|" to include a bar in a mapping, this needs to be replaced by "^V|". See |:bar|. Key codes changed *key-codes-changed* The internal representation of key codes has changed dramatically. In 3.0 a one-byte code was used to represent a key. This caused problems with different characters sets that also used these codes. In 4.0 a three-byte code is used that cannot be confused with a character. |key-notation| If you have used the single-byte key codes in your vimrc for mappings, you will have to replace them with the 4.0 codes. Instead of using the three-byte code directly, you should use the symbolic representation for this in . See the table below. The table also lists the old name, as it was used in the 3.0 documentation. The key names in can be used in mappings directly. This makes it possible to copy/paste examples or type them literally. The notation has been introduced for this ||. The 'B' and '