*version6.txt* For Vim version 6.0j. Last change: 2000 Oct 22 VIM REFERENCE MANUAL by Bram Moolenaar Welcome to Vim Version 6.0! Vim 2001, a folding space odyssey Where do you want to fold today? This document lists the differences between Vim 5.x and Vim 6.0. See |vi_diff.txt| for an overview of differences between Vi and Vim 5.0. See |version4.txt| for differences between Vim 3.0 and Vim 4.0. See |version5.txt| for differences between Vim 4.0 and Vim 5.0. INCOMPATIBLE CHANGES |incompatible-6| Cursor position in Visual mode |curpos-visual| CR in substitute command |substitute-CR| 'include' option local |include-local| global option values used |new-global-values| 'fileencoding' obsolete |fileencoding-obsolete| Digraphs changed |digraphs-changed| Filetype detection changed |filetypedetect-changed| CTRL-U in Command-line mode |CTRL-U-changed| Ctags gone |ctags-gone| Documentation |documentation-6| Small incompatibilities |incomp-small-6| NEW FEATURES Folding |new-folding| Vertically split windows |new-vertsplit| Extended search patterns |new-searchpat| Flexible indenting |new-indent-flex| UTF-8 support |new-utf-8| Multi-language support |new-multi-lang| Plugin support |new-plugins| Filetype plugins |new-filetype-plugins| Cursor in virtual position |new-virtedit| Debugger interface |new-debug-itf| Buffer types |new-buftype| Ports |ports-6| Quickfix extended |quickfix-6| Operator modifiers |new-operator-mod| Search Path |new-search-path| Writing files |new-file-writing| Various new items |new-items-6| IMPROVEMENTS |improvements-6| COMPILE TIME CHANGES |compile-changes-6| BUG FIXES |bug-fixes-6| ============================================================================== INCOMPATIBLE CHANGES *incompatible-6* These changes are incompatible with previous releases. Check this list if you run into a problem when upgrading from Vim 5.x to 6.0 Cursor position in Visual mode *curpos-visual* ------------------------------ When going from one window to another window on the same buffer while in Visual mode, the cursor position of the other window is adjusted to keep the same Visual area. This can be used to set the start of the Visual area in one window and the end in another. CR in substitute command *substitute-CR* ------------------------ The substitute string has been made Vi compatible. Previously a CTRL-V had a special meaning and could be used to prevent a to insert a line break. This made it impossible to insert a CTRL-V at the end of a line. Now a backslash is used to prevent a to cause a line break. Since the number of backslashes is halved, it is still possible to insert a line break at the end of the line. This now works just like Vi, but it's not compatible with Vim versions before 6.0. 'include' option local *include-local* ---------------------- The 'include' option is now local to the buffer. Each language may require another 'include' option value. This only matters if you set the 'include' option and expect it to have the new value in other buffers too. Global option values used *new-global-values* ------------------------- There are now global values for options which are local to a buffer or window. Previously the local options were copied from one buffer to another. When editing another file this could cause options set in a modeline to be used for the wrong file. Now the global values are used when entering a buffer that has not been used before. Also, when editing another buffer in a window, the local window options are reset to their global values. The ":set" command sets both the local and global values, this is still compatible. But a modeline only sets the local value, this is not backwards compatible. 'fileencoding' obsolete *fileencoding-obsolete* ----------------------- 'fileencoding' is no longer to be used. It is now equivalent to the new 'charcode' option, which is global. 'fileencoding' was local to a buffer, but it could never be different between buffers, because it changed the way text in all buffers was interpreted. The FileEncoding autocommand now does the same as the new CharCode event. Digraphs changed *digraphs-changed* ---------------- The default digraphs now correspond to RFC1345. This is different from what was used in Vim 5.x. |digraphs| Filetype detection changed *filetypedetect-changed* -------------------------- The filetype detection previously was using the "filetype" autocommand group. This caused confusion with the FileType event name. The group is now called "filetypedetect". It still works, but if the "filetype" group is used the autocommands will not be removed by ":filetype off". The support for 'runtimepath' has made the "myfiletypefile" and "mysyntaxfile" mechanism obsolete. They are still used for backwards compatibility. The connection between the FileType event and setting the 'syntax' option was previously in the "syntax" autocommand group. That caused confusion with the Syntax event name. The group is now called "syntaxset". CTRL-U in Command-line mode *CTRL-U-changed* --------------------------- CTRL-U in the command line cleared the whole line. Most shells only delete the characters before the cursor. Made it like that. (Steve Wall) You can get the old behavior with CTRL-E CTRL-U: > :cnoremap Ctags gone *ctags-gone* ---------- Ctags is no longer part of the Vim distribution. It's now a grown-up program by itself, it deserves to be distributed separately. However, the binary archives do include the ctags program, since it's small and useful. Ctags can be found here: http://darren.hiebert.com/ctags/index.html. Documentation *documentation-6* ------------- The documentation has been reorganized, an item may not be where you found it in Vim 5.x. - Split into a reference manual and a user manual. - Put the quick reference in a separate file (so that it can be printed). The examples in the documentation were previously marked with a ">" in the first column. This made it difficult to copy/paste them. There is now a single ">" before the example and it ends at a "<" or a non-blank in the first column. This also looks better without highlighting. When syntax highlighting is not enabled, the characters in the help file which mark examples ('>' and '<') and header lines ('~') are replaced with a space. The help window now always appears at the top of the Vim window. Previously it appeared above the current window. 'helpfile' is no longer used to find the help tags file. This allows a user to add its own help files (e.g., for plugins). Small incompatibilities *incomp-small-6* ----------------------- Removed '_' from the 'breakat' default: It's commonly used in keywords. The default for 'mousehide' is on, because this works well form most people. The Amiga binary is now always compiled with 'big" features. The "big" binary archive no longer exists. The items "[RO]", "[+]", "[help]", "[Preview]" and "[filetype]" in 'statusline' no longer have a leading space. Non-Unix systems: When expanding wildcards for the Vim arguments, don't use 'suffixes'. It now works as if the shell had expanded the arguments. The 'lisp', 'smartindent' and 'cindent' options are not switched off when 'paste' is set. The auto-indenting is disabled when 'paste' is set, but manual indenting with "=" still works. When formatting with "=" uses 'cindent' or 'indentexpr' indenting, and there is no change in indent, this is not counted as a change ('modified' isn't set and there is nothing to undo). ============================================================================== NEW FEATURES Folding *new-folding* ------- Vim can now display a buffer with text folded. This allows overviewing the structure of a file quickly. It is also possible to move folded text, for example to move a function to another position. See |folding|. Vertically split windows *new-vertsplit* ------------------------ Windows can also be split vertically. This makes it possible to have windows side by side. One nice use for this is to compare two similar files. The 'scrollbind' option can be used to synchronize scrolling. A vertical split can be created with the commands: :vsplit or CTRL-W v or CTRL-W CTRL-V |:vsplit| :vnew |:vnew| :vertical {cmd} |:vertical| The last one is a modifier, which has a meaning for any command that splits a window. For example: > :vertical stag main Will vertically split the window and jump to the tag "main" in the new window. Moving from window to window horizontally can be done with the |CTRL-W_h| and |CTRL-W_l| commands. The |CTRL-W_k| and |CTRL-W_j| commands have been changed to jump to the window above or below the cursor position. The vertical and horizontal splits can be mixed as you like. Resizing windows is easy when using the mouse, just position the pointer on a status line or vertical separator and drag it. In the GUI a special mouse pointer shape indicates where you can drag a status or separator line. To resize vertically split windows use the |CTRL-W_<| and |CTRL-W_>| commands. To make a window the maximum width use the CTRL-W | command |CTRL-W_bar|. To force a new window to use the full width or height of the Vim window, these two modifiers are available: :topleft {cmd} New window appears at the top with full width or at the left with full height. :botright {cmd} New window appears at the bottom with full width or at the right with full height. This can be combined with ":vertical" to force a vertical split: > :vert bot dsplit DEBUG This will open a window at the far right, occupying the full height of the Vim window, with the cursor on the first definition of "DEBUG". The help window is always opened at the top, like ":topleft" was used. A few options can be used to set the preferences for vertically split windows. They work similar to their existing horizontal equavalents: horizontal vertical ~ 'splitbelow' 'splitright' 'winheight' 'winwidth' 'winminheight' 'winminwidth' It's possible to set 'winminwidth' to zero, so that temporarliy unused windows hardly take up space without closing them. The new 'eadirection' option tells where 'equalalways' applies: :set eadirection=both both directions :set eadirection=ver equalize window heights :set eadirection=hor equalize windows widths This can be used to avoid changing window sizes when you want to keep them. Since windows can become quite narrow with vertical splits, text lines will often not fit. The 'sidescrolloff' has been added to keep some context left and right of the cursor. The 'listchars' option has been extended with the "precedes" item, to show a "<" for example, when there is text left off the screen. (Utz-Uwe Haus) Flexible indenting *new-indent-flex* ------------------ Automatic indenting is now possible for any language. It works with a Vim script, which makes it very flexible to compute the indent. The 'indentexpr' option is evaluated to get the indent for a line. The 'indentkeys' option tells when to trigger re-indenting. Normally these options are set from an indent script. Like Syntax files, indent scripts will be created and maintained by many people. Extended search patterns *new-searchpat* ------------------------ Multi-line patterns: (Loic Grenie) \n match end-of-line, also in [] \_[] match characters in range and end-of-line \_x match character class and end-of-line \_. match any character or end-of-line \c ignore case for the whole pattern \C match case for the whole pattern \m magic on for the following \M magic off for the following \@! don't match atom before it. Example: "foo\(bar\)\@!" matches "foo " but not "foobar". \@= match atom, resulting in zero-width match Example: "foo\(bar\)\@=" matches "foo" in "foobar". \@ match preceding atom as a subexpression \& match only when branch before and after it match For syntax items: \z(...\) external reference match set (in region start pattern) \z1 - \z9 external reference match use (in region skip or end pattern) (Scott Bigham) \zs use position as start of match \ze use position as end of match Removed limit of matching only up to 32767 times with *, \+, etc. Added some support for double-byte characters. (Muraoka) UTF-8 support *new-utf-8* ------------- Vim can now edit files in UTF-8 encoding. Up to 31 bit characters can be used, but only 16 bit characters are displayed. Up to two combining characters are supported, they overprint the preceding character. Double-width characters are also supported. See |UTF-8|. UCS-2 and UCS-4 encodings are supported too, they are converted to UTF-8 internally. Multi-byte: - Added 'charcode' option: specifies character coding used inside Vim. - Added 'filecharcode' and 'filecharcodes': specify character coding in a file. - Added 'charconvert' option: expression used to convert between character encodings. - Added 'guifontwide' for double-width font. - Added Korean support for character class detection. Also fix cls() in search.c. (Chong-Dae Park) Allow defining digraphs for multi-byte characters. Added RFC1345 digraphs for Unicode. Multi-language support *new-multi-lang* ---------------------- - Added +multi_lang feature. - Prepared for use of gettext() by putting translatable strings in _(). Added "po" directory with German and Polish translations. (Marcin Dalecki) - Added v:lang variable to be able to get current language setting. (Marcin Dalecki) - Added ":language" command to set the language (locale) - Added ":menutrans" to be able to translate menu paths. - Added German and Polish menu translations (Marcin Dalecki) - removed "broken locale" (Marcin Dalecki0. - don't user color names in icons, use RGB values. - Win32: Added global IME support (Muraoka) Plugin support *new-plugins* -------------- To make it really easy to load a Vim script when starting Vim, the "plugin" runtime directory can be used. All "*.vim" files in it will be automatically loaded. For Unix, the directory "~/.vim/plugin" is used by default. The 'runtimepath' option can be set to look in other directories for plugins. |load-plugins| |add-plugin| The |:runtime| command has been added to load one or more files in 'runtimepath'. Added support for local help files. |add-local-help|. When searching for help tags, all "doc/tags" files in 'runtimepath' are used. Added the ":helptags" command: Generate a tags file for a help directory. The first line of each help file is automagically added to the "LOCAL ADDITIONS" section in doc/help.txt. argument to ":map": only add a mapping when it wasn't defined before. Filetype plugins *new-filetype-plugins* ----------------- A new group of files has been added to do settings for specific file types. These can be options and mappings which are specifically used for one value of 'filetype'. The files are located in "$VIMRUNTIME/ftplugin". The 'runtimepath' option makes it possible to use several sets of plugins: Your own, system-wide, included in the Vim distribution, etc. To be able to make this work, several features were added: - Added the "s:" variables, local to a script. Avoids name conflicts with global variables. They can be used in the script and in functions, autocommands and user commands defined in the script. |s:var| automatically deletes them when the script ends. - Added the global value for local options. This value is used when opening a new buffer or editing another file. The option value specified in a modeline or filetype setting is not carried over to another buffer. ":set" sets both the local and the global value. ":setlocal" sets the local option value only. ":setglobal" displays the global value for a local option. Setting only the global value isn't implemented yet. - Added mappings and abbreviations local to a buffer: ":map ". - In a mapping "" can be used to get the value of the "mapleader" variable. This simplifies mappings that use "mapleader". "" defaults to "\". "" does the same with "maplocalleader". This is to be used for mappings local to a buffer. - Added Script ID to define functions and mappings local to a script. - Added