*version7.txt* For Vim version 7.0aa. Last change: 2005 Aug 15 VIM REFERENCE MANUAL by Bram Moolenaar Welcome to Vim 7! A large number of features has been added. This file mentions all the new items, changes to existing features and bug fixes compared to Vim 6.x. Use this command to see the version you are using: > :version See |vi_diff.txt| for an overview of differences between Vi and Vim 7.0. See |version4.txt| for differences between Vim 3.x and Vim 4.x. See |version5.txt| for differences between Vim 4.x and Vim 5.x. See |version6.txt| for differences between Vim 5.x and Vim 6.x. INCOMPATIBLE CHANGES |incompatible-7| NEW FEATURES |new-7| Vim script enhancements |new-vim-script| Spell checking |new-spell| KDE support |new-KDE| MzScheme interface |new-MzScheme| Printing multi-byte text |new-print-multi-byte| Translated manual pages |new-manpage-trans| Internal grep |new-vimgrep| Scroll back in messages |new-scroll-back| POSIX compatibility |new-posix| Debugger support |new-debug-support| Remote file explorer |new-netrw-explore| Various new items |new-items-7| IMPROVEMENTS |improvements-7| COMPILE TIME CHANGES |compile-changes-7| BUG FIXES |bug-fixes-7| ============================================================================== INCOMPATIBLE CHANGES *incompatible-7* These changes are incompatible with previous releases. Check this list if you run into a problem when upgrading from Vim 6.x to 7.0. A ":write file" command no longer resets the 'modified' flag of the buffer, unless the '+' flag is in 'cpoptions' |cpo-+|. This was illogical, since the buffer is still modified compared to the original file. And when undoing all changes the file would actually be marked modified. It does mean that ":quit" fails now. ":helpgrep" now uses a help window to display a match. In an argument list double quotes could be used to include spaces in a file name. This caused a difference between ":edit" and ":next" for escaping double quotes and it is incompatible with some versions of Vi. Command Vim 6.x file name Vim 7.x file name ~ :edit foo\"888 'foo"888' 'foo"888' :next foo\"888 'foo888' 'foo"888' :next a\"b c\"d 'ab cd' 'a"b' and 'c"d' In a |literal-string| a single quote can be doubled to get one. ":echo 'a''b'" would result in "a b", but now that two quotes stand for one it results in "a'b". When overwriting a file with ":w! fname" there was no warning for when "fname" was being edited by another Vim. Vim now gives an error message |E768|. Minor incompatibilities: For filetype detection: For many types, instead of ~/.dir/filename use */.dir/filename, so that it also works for other user's files. ":0verbose" now sets 'verbose' to zero instead of one. Removed the old and incomplete "VimBuddy" code. Buffers without a name report "No Name" instead of "No File". It was confusing for buffers with a name and 'buftype' set to "nofile". When ":file xxx" is used in a buffer without a name, the alternate file name isn't set. This avoids creating buffers without a name that are not useful. The "2html.vim" script now converts closed folds to HTML. This means the HTML looks like its displayed, with the same folds open and closed. Use "zR", or "let html_ignore_folding=1", if no folds should appear in the HTML. (partly by Carl Osterwisch) Diff mode now is also converted as it is displayed. Win32: The effect of the key depended on 'winaltkeys'. Now it depends on whether has been mapped or not. This allows mapping without changing 'winaltkeys'. When 'octal' is in 'nrformats' and using CTRL-A on "08" it became "018", which is illogical. Now it becomes "9". The leading zero(s) is(are) removed to avoid the number becoming octal after incrementing "009" to "010". When 'encoding' is set to a Unicode encoding, the value for 'fileencodings' now includes "default" before "latin1". This means that for files with 8-bit encodings the default is to use the encoding specified by the environment, if possible. Previously latin1 would always be used, which is wrong in a non-latin1 environment, such as Russian. Previously Vim would exit when there are two windows, both of them displaying a help file, and using ":quit". Now only the window is closed. "-w {scriptout}" only works when {scriptout} doesn't start with a digit. Otherwise it's used to set the 'window' option. Previously and could be mapped separately. This had the disadvantage that all mappings (with modifiers) had to be duplicated, since you can't be sure what the keyboard generates. Now all are internally translated to , both for the keys and for mappings. Also for , , etc. ":put" now leaves the cursor on the last inserted line. When a .gvimrc file exists then 'compatible' is off, just like when a ".vimrc" file exists. ============================================================================== NEW FEATURES *new-7* Vim script enhancements *new-vim-script* ----------------------- In Vim scripts the following types have been added: List ordered list of items |List| Dictionary associative array of items |Dictionary| Funcref reference to a function |Funcref| Many functions and commands have been added to support the new types. The |string()| function can be used to get a string representation of a variable. Works for Numbers, Strings and composites of them. Then |eval()| can be used to turn the string back into the variable value. The |:let| command can now use ":let var += expr" like using ":let var = var + expr". "-=" and ".=" works in a similar way. With the |:profile| command you can find out where your function or script wastes its time. Spell checking *new-spell* -------------- Spell checking has been integrated in Vim. There were a few implementations with scripts, but they were slow and/or required an external program. The 'spell' option is used to switch spell checking on or off. The 'spelllang' option is used to specify the languages that are accepted. The 'spellfile' option specifies where new words are added. The 'spellsuggest' option specifies the methods used for making suggestions The |[s| and |]s| commands can be used to move to the next or previous error. The |zg| and |zw| commands can be used to add good and wrong words. The |z?| command can be used to correct the word. The |:mkspell| command is used to generate a Vim spell file from word lists. The "undercurl" highlighting attribute was added to nicely point out spelling mistakes in the GUI (based on patch from Marcin Dalecki). The "guisp" color can be used to give it a color different from foreground and background. The number of possible different highlight attributes was raised from about 220 to over 30000. This allows for the attributes of spelling to be combined with syntax highlighting attributes. This is also used for syntax highlighting. Much more info here: |spell|. KDE support *new-KDE* ----------- Kvim is the KDE version of Vim. It uses the Qt toolkit. See |KVim|. (Thomas Capricelli, Philippe Fremy, Mickael Marchand, Mark Westcott, et al.) MzScheme interface *new-MzScheme* ------------------ The MzScheme interpreter is supported. |MzScheme| The |:mzscheme| command can be used to execute MzScheme commands. The |:mzfile| command can be used to execute an MzScheme script file. Printing multi-byte text *new-print-multi-byte* ------------------ The |:hardcopy| command now supports printing multi-byte characters. The 'printmbcharset' and 'printmbfont' options are used for this. Also see |postscript-cjk-printing|. (Mike Williams) Translated manual pages *new-manpage-trans* ----------------------- The manual page of Vim and associated programs is now also available in several other languages. French - translated by David Blanchet Italian - translated by Antonio Colombo Russian - translated by Vassily Ragosin The Unix Makefile installs the Italian manual pages in .../man/it/man1/, .../man/it.ISO8859-1/man1/ and .../man/it.UTF-8/man1/. There appears to be no standard for what encoding goes in the "it" directory, the 8-bit encoded file is used there as a best guess. Other languages are installed in similar places. The translated pages are not automatically installed when Vim was configured with "--disable-nls", but "make install-languages install-tool-languages" will do it anyway. Internal grep *new-vimgrep* ------------- The ":vimgrep" command can be used to search for a pattern in a list of files. This is like the ":grep" command, but no external program is used. Besides better portability, handling of different file encodings and using multi-line patterns, this also allows grepping in compressed and remote files. |:vimgrep|. If you want to use the search results in a script you can use the |getqflist()| function. To search in files in various directories the "**" pattern can be used. It expands into an arbitrary depth of directories. "**" can be used in all places where file names are expanded, thus also with |:next| and |:args|. Scroll back in messages *new-scroll-back* ----------------------- When displaying messages, at the |more-prompt| and the |hit-enter-prompt|, The 'k', 'u' and 'b' keys can be used to scroll back to previous messages. This is especially useful for commands such as ":syntax", ":autocommand" and ":highlight". This is implemented in a generic way thus it works for all commands and highlighting is kept. Only works when the 'more' option is set. Previously it only partly worked for ":clist". The |g<| command can be used to see the last page of messages after you have hit at the |hit-enter-prompt|. Then you can scroll further back. POSIX compatibility *new-posix* ------------------- The POSIX test suite was used to verify POSIX compatibility. A number of problems have been fixed to make Vim more POSIX compatible. Some of them conflict with traditional Vi or expected behavior. The $VIM_POSIX environment variable can be set to get POSIX compatibility. See |posix|. Items that were fixed for both Vi and POSIX compatibilty: - repeating "R" with a count only overwrites text once; added the 'X' flag to 'cpoptions' |cpo-X| - a vertical movement command that moves to a non-existing line fails; added the '-' flag to 'cpoptions' |cpo--| - when preserving a file and doing ":q!" the file can be recovered; added the '&' flag to 'cpoptions' |cpo-&| - The 'window' option is partly implemented. It specifies how much CTRL-F and CTRL-B scroll when there is one window. The "-w {number}" argument is now accepted. "-w {scriptout}" only works when {scriptout} doesn't start with a digit. - Allow "-c{command}" argument, no space between "-c" and {command}. - When writing a file with ":w!" don't reset 'readonly' when 'Z' is present in 'cpoptions'. - Allow 'l' and '#' flags for ":list", ":print" and ":number". - Added the '.' flag to 'cpoptions': ":cd" fails when the buffer is modified. - In Ex mode with an empty buffer ":read file" doesn't keep an empty line above or below the new lines. - Remove a backslash before a NL for the ":global" command. - When ":append", ":insert" or ":change" is used with ":global", get the inserted lines from the command. Can use backslash-NL to separate lines. - Can use ":global /pat/ visual" to execute Normal mode commands at each matched line. Use "Q" to continue and go to the next line. - The |:open| command has been partially implemented. It stops Ex mode, but redraws the whole screen, not just one line as open mode is supposed to do. - Support using a pipe to read the output from and write input to an external command. Added the 'shelltemp' option and has("filterpipe"). - In ex silent mode the ":set" command output is displayed. - The ":@@" and ":**" give an error message when no register was used before. - The search pattern "[]-`]" matches ']', '^', '_' and '`'. - Autoindent for ":insert" is using the line below the insert. - Autoindent for ":change" is using the first changed line. - Editing Ex command lines is not done in cooked mode, because CTRL-D and CTRL-T cannot be handled then. - In Ex mode, "1,3" prints three lines. "%" prints all lines. - In Ex mode "undo" would undo all changes since Ex mode was started. - Implemented the 'prompt' option. Debugger support *new-debug-support* ---------------- The 'balloonexpr' option has been added. This is a generic way to implement balloon functionality. You can use it to show info for the word under the mouse pointer. Remote file explorer *new-netrw-explore* -------------------- The netrw plugin now also supports viewing a directory, when "scp://" is used. Deleting and renaming files is possible. To avoid duplicating a lot of code, the previous file explorer plugin has been integrated in the netrw plugin. This means browsing local and remote files works the same way. ":browse edit" and ":browse split" use the netrw plugin when it's available and a GUI dialog is not possible. The netrw plugin is maintained by Charles Campbell. Various new items *new-items-7* ----------------- Normal mode commands: ~ a", a' and a` New text objects to select quoted strings. |a'| i", i' and i' (Taro Muraoka) CTRL-W In the quickfix window: opens a new window to show the location of the error under the cursor. |at| and |it| text objects select a block of text between HTML or XML tags. Insert mode commands: ~ CTRL-\ CTRL-O Execute a Normal mode command. Like CTRL-O but without moving the cursor. Options: ~ 'completefunc' The name of a function used for user-specified Insert mode completion. CTRL-X CTRL-U can be used in Insert mode to do any kind of completion. (Taro Muraoka) 'quoteescape' Characters used to escape quotes inside a string. Used for the a", a' and a` text objects. |a'| 'numberwidth' Minimal width of the space used for the 'number' option. (Emmanuel Renieris) 'mzquantum' Time in msec to schedule MzScheme threads. 'printmbcharset' CJK character set to be used for :hardcopy 'printmbfont' font names to be used for CJK output of :hardcopy 'fsync' Whether fsync() is called after writing a file. (Ciaran McCreesh) 'wildoptions' "tagfile" value enables listing the file name of matching tags for CTRL-D command line completion. (based on an idea from Yegappan Lakshmanan) 'formatlistpat' pattern to recognize a numbered list for formatting. (idea by Hugo Haas) 'spell' switch spell checking on/off 'spelllang' languages to check spelling for 'spellsuggest' methods for spell suggestions 'synmaxcol' maximum column to look for syntax items; avoids very slow redrawing when there are very long lines 'verbosefile' Log messages in a file. Ex commands: ~ Win32: The ":winpos" command now also works in the console. (Vipin Aravind) |:startreplace| Start Replace mode. (Charles Campbell) |:0file| Removes the name of the buffer. (Charles Campbell) |:diffoff| Switch off diff mode in the current window or in all windows. |:keepalt| Do not change the alternate file. |:delmarks| Delete marks. |:sandbox| Command modifier: execute the argument in the sandbox. |:exusage| Help for Ex commands (Nvi command). |:viusage| Help for Vi commands (Nvi command). |:cbuffer| Read error lines from a buffer. (partly by Yegappan Lakshmanan) |:sort| Sort lines in the buffer without depending on an external command. |:caddfile| Add error messages to an existing quickfix list (Yegappan Lakshmanan). |:cexpr| Read error messages from a Vim expression (Yegappan Lakshmanan). New functions: ~ |add()| append an item to a List |append()| append List of lines to the buffer |browsedir()| dialog to select a directory |byteidx()| index of a character (Ilya Sher) |call()| call a function with List as arguments |complete_add()| add match for 'completefunc' |complete_check()| check for key pressed, for 'completefunc' |copy()| make a shallow copy of a List or Dictionary |count()| count nr of times a value is in a List or Dictionary |deepcopy()| make a full copy of a List or Dictionary |empty()| check if List or Dictionary is empty |getqflist()| list of quickfix errors (Yegappan Lakshmanan) |extend()| append one List to another or add items from one Dictionary to another |filter()| remove selected items from a List or Dictionary |finddir()| find a directory in 'path' |findfile()| find a file in 'path' (Johannes Zellner) |foldtextresult()| the text displayed for a closed fold at line "lnum" |function()| make a Funcref out of a function name |get()| get an item from a List or Dictionary |getbufline()| get a list of lines from a specified buffer (Yegappan Lakshmanan) |getfontname()| get actual font name being used |getfperm()| get file permission string (Nikolai Weibull) |getftype()| get type of file (Nikolai Weibull) |getline()| with second argument: get List with buffer lines |has_key()| check whether a key appears in a Dictionary |insert()| insert an item somewhere in a List |items()| get List of Dictionary key-value pairs |join()| join List items into a String |keys()| get List of Dictionary keys |len()| number of items in a List or Dictionary |map()| change each List or Dictionary item |matchlist()| list with match and submatches of a pattern in a string |max()| maximum value in a List or Dictionary |min()| minimum value in a List or Dictionary |mkdir()| create a directory |printf()| format text |readfile()| read a file into a list of lines |remove()| remove one or more items from a List or Dictionary |repeat()| repeat "expr" "count" times (Christophe Poucet) |reverse()| reverse the order of a List |setqflist()| create a quickfix list (Yegappan Lakshmanan) |sort()| sort a List |soundfold()| get the sound-a-like equivalent of a word |split()| split a String into a List |spellbadword()| get a badly spelled word |spellsuggest()| get suggestions for correct spelling |string()| string representation of a List or Dictionary |system()| filters {input} through a shell command |taglist()| get list of matching tags (Yegappan Lakshmanan) |tr()| translate characters (Ron Aaron) |values()| get List of Dictionary values |writefile()| write a list of lines into a file User defined functions can now be loaded automatically from the "autoload" directory in 'runtimepath'. See |autoload-functions|. New autocommand events: ~ |InsertEnter| starting Insert or Replace mode |InsertChange| going from Insert to Replace mode or back |InsertLeave| leaving Insert or Replace mode |ColorScheme| after loading a color scheme |QuickFixCmdPre| before :make, :grep et al. (Ciaran McCreesh) |QuickFixCmdPost| after :make, :grep et al. (Ciaran McCreesh) New items in search patterns: ~ |/\%d| \%d123 search for character with decimal number |/\]| [\d123] idem, in a colletion |/\%o| \%o103 search for character with octal number |/\]| [\o1o3] idem, in a colletion |/\%x| \%x1a search for character with 2 pos. hex number |/\]| [\x1a] idem, in a colletion |/\%u| \%u12ab search for character with 4 pos. hex number |/\]| [\u12ab] idem, in a colletion |/\%U| \%U1234abcd search for character with 8 pos. hex number |/\]| [\U1234abcd] idem, in a colletion (The above partly by Ciaran McCreesh) |/[[=| [[=a=]] an equivalence class (only for latin1 characters) |/[[.| [[.a.]] a collation element (only works with single char) Nesting |/multi| items no longer is an error when an empty match is possible. It is now possible to use \{0}, it matches the preceding atom zero times. Not useful, just for compatibility. New Syntax/Indent/FTplugin files: ~ MuPAD source syntax, indent and ftplugin. (Dave Silvia) ABAB/4 syntax file. (Marius van Wyk) SQL-Informix syntax file. (Dean L Hill) PHP compiler plugin. (Doug Kearns) Sive syntax file. (Nikolai Weibull) Pascal indent file. (Neil Carter) Many filetype plugins and others from Nikolai Weibull. Xquery syntax file. (Jean-Marc Vanel) Moved all the indent settings from the filetype plugin to the indent file. Implemented b:undo_indent to undo indent settings when setting 'filetype' to a different value. New Keymaps: ~ Sinhala (Sri Lanka) (Harshula Jayasuriya) New message translations: ~ The Ukranian messages are now also available in cp1251. Irish message translations. (Kevin Patrick Scannell) Vietnamese message translations and menu. (Phan Vinh Thinh) Others: ~ Mac: Add the selection type to the clipboard, so that Block, line and character selections can be used between two Vims. (Eckehard Berns) Also fixes the problem that setting 'clipboard' to "unnamed" breaks using "yyp". Mac: GUI font selector. (Peter "Rain Dog" Cucka) Mac: support for multi-byte characters. (Da Woon Jung) GUI font selector for Motif. (Marcin Dalecki) Nicer toolbar buttons for Motif. (Marcin Dalecki) Mnemonics for the Motif find/replace dialog. (Marcin Dalecki) Mac: better integration with Xcode. Post a fake mouse-up event after the odoc event and the drag receive handler to work around a stall after Vim loads a file. Fixed an off-by-one line number error. (Da Woon Jung) Added the t_SI and t_EI escape sequences for starting and ending Insert mode. To be used to set the cursor shape to a bar or a block. No default values, they are not supported by termcap/terminfo. Autocommands can be defined local to a buffer. This means they will also work when the buffer does not have a name or no specific name. See |autocmd-buflocal|. (Yakov Lerner) For xterm most combinations of modifiers with function keys are recognized. |xterm-modifier-keys| When 'verbose' is set the output of ":highlight" will show where a highlight item was last set. When 'verbose' is set the output of ":map" will show where a key map was last defined. (Yegappan Lakshmanan) ============================================================================== IMPROVEMENTS *improvements-7* ":helpgrep" accepts a language specifier after the pattern: "pat@it". Move the help for printing to a separate help file. It's quite a lot now. The pattern matching code was changed from a recursive function to an iterative mechanism. This avoids out-of-stack errors. State is stored in allocated memory, running out of memory can always be detected. Allows matching more complex things, but Vim may seem to hang while doing that. ":breakadd here" and ":breakdel here" can be used to set or delete a breakpoint at the cursor. The tutor was updated to make it simpler to use and added text to explain a few more important commands. Used ideas from Gabriel Zachmann. Unix: When libcall() fails obtain an error message with dlerror() and display it. (Johannes Zellner) Added "nbsp" in 'listchars'. (David Blanchet) Added the "acwrite" value for the 'buftype' option. This is for a buffer that doesn not have a name that refers to a file and is written with BufWriteCmd autocommands. For lisp indenting and matching parenthesis: (Sergey Khorev) - square brackets are recognized properly - #\(, #\), #\[ and #\] are recognized as character literals - Lisp line comments (delimited by semicolon) are recognized Added the "count" argument to match(), matchend() and matchstr(). (Ilya Sher) winnr() takes an optional "$" and "#" arguments. (Nikolai Weibull, Yegappan Lakshmanan) Added 'n' flag to search(): don't move the cursor. (Nikolai Weibull) When uncompressing fails in the gzip plugin, give an error message but don't delete the raw text. Helps if the file has a .gz extension but is not actually compressed. (Andrew Pimlott) When C, C++ or IDL syntax is used, may additionally load doxygen syntax. Also support setting the filetype to "cdoxygen" for C plus doxygen syntax. (Michael Geddes) The ":registers" command now displays multi-byte characters properly. VMS: In the usage message mention that a slash can be used to make a flag upper case. Add color support to the builtin vt320 terminal codes. (Zoltan Arpadffy) For the '%' item in 'viminfo', allow a number to set a maximum for the number of buffers. The 'statusline' option can be local to the window, so that each window can have a different value. (partly by Yegappan Lakshmanan) When a file looks like a shell script, check for an "exec" command that starts the tcl interpreter. (suggested by Alexios Zavras) Support conversion between utf-8 and latin9 (iso-8859-15) internally, so that digraphs still work when iconv is not available. When a session file is loaded while editing an unnamed, empty buffer that buffer is wiped out. Avoids that there is an unused buffer in the buffer list. Win32: When libintl.dll supports bind_textdomain_codeset(), use it. (NAKADAIRA Yukihiro) When foldtext() finds no text after removing the comment leader, use the second line of the fold. Helps for C-style /* */ comments where the first line is just "/*". When editing the same file from two systems (e.g., Unix and MS-Windows) there mostly was no warning for an existing swap file, because the name of the edited file differs (e.g., y:\dir\file vs /home/me/dir/file). Added a flag to the swap file to indicate it is in the same directory as the edited file. The used path then doesn't matter and the check for editing the same file is much more reliable. Client-server communication now supports 'encoding'. When setting 'encoding' in a Vim server to "utf-8", and using "vim --remote fname" in a console, "fname" is converted from the console encoding to utf-8. Also allows Vims with different 'encoding' settings to exchange messages. Internal: Changed ga_room into ga_maxlen, so that it doesn't need to be incremented/decremented each time. Included a few improvements for Motif from Marcin Dalecki. Draw label contents ourselves to make them handle fonts in a way configurable by Vim and a bit less dependent on the X11 font management. When a register is empty it is not stored in the viminfo file. Removed the tcltags script, it's obsolete. ":redir @*>>" and ":redir @+>>" append to the clipboard. Better check for invalid characters after the register name. |:redir| ":redir => variable" and ":redir =>> variable" write or append to a variable. (Yegappan Lakshmanan) |:redir| ":redir @{a-z}>>" appends to register a to z. (Yegappan Lakshmanan) The 'verbosefile' option can be used to log messages in a file. Verbose messages are not displayed then. The "-V{filename}" argument can be used to log startup messages. ":let g:" lists global variables. ":let b:" lists buffer-local variables. ":let w:" lists window-local variables. ":let v:" lists Vim variables. The stridx() and strridx() functions take a third argument, where to start searching. (Yegappan Lakshmanan) The getreg() function takes an extra argument to be able to get the expression for the '=' register instead of the result of evaluating it. The setline() function can take a List argument to set multiple lines. When the line number is just below the last line the line is appended. g CTRL-G also shows the number of characters if it differs from the number of bytes. Completion for ":debug" and entering an expression for the '=' register. Skip ":" between range and command name. (Peter winters) CTRL-Q in Insert mode now works like CTRL-V by default. Previously it was ignored. When "beep" is included in 'debug' a function or script that causes a beep will result in a message with the source of the error. When completing buffer names, match with "\(^\|[\/]\)" instead of "^", so that ":buf stor" finds both "include/storage.h" and "storage/main.c". To count items (pattern matches) without changing the buffer the 'n' flag has been added to |:substitute|. See |count-items|. The "screen.linux" $TERM name is recognized to set the default for 'background' to "dark". (Ciaran McCreesh) Also for "cygwin". The |FileChangedShell| autocommand event can now use the |v:fcs_reason| variable that specifies what triggered the event. |v:fcs_choice| can be used to reload the buffer or ask the user what to do. Not all modifiers were recognized for xterm function keys. Added the possibility in term codes to end in ";*X" or "O*X", where X is any character and the * stands for the modifier code. Added the , , and keys, to be able to recognize the two forms that xterm can send their codes in and still handle all possible modifiers. getwinvar() now also works to obtain a buffer-local option from the specified window. Added the "%s" item to 'errorformat'. (Yegappan Lakshmanan) GTK GUI: use the GTK file dialog when it's available. Mix from patches by Grahame Bowland and Evan Webb. Added ":scriptnames" to bugreport.vim, so that we can see what plugins were used. Win32: If the user changes the setting for the number of lines a scroll wheel click scrolls it is now used immediately. Previously Vim would need to be restarted. When using @= in an expression the value is expression @= contains. ":let @= = value" can be used to set the register contents. A ! can be added to ":popup" to have the popup menu appear at the mouse pointer position instead of the text cursor. The table with encodings has been expanded with many MS-Windows codepages, such as cp1250 and cp737, so that these can also be used on Unix without prepending "8bit-". When an encoding name starts with "microsoft-cp" ignore the "microsoft-" part. Added the "customlist" completion argument to a user-defined command. The user-defined completion function should return the completion candidates as a Vim List and the returned results are not filtered by Vim. (Yegappan Lakshmanan) Win32: Balloons can have multiple lines if common controls supports it. (Sergey Khorev) The 's' flag is added to the search() and searchpair() function to set the ' mark if the cursor is moved. (Yegappan Lakshmanan) For 'errorformat' it was not possible to have a file name that contains the character that follows after "%f". For example, in "%f:%l:%m" the file name could not contain ":". Now include the first ":" where the rest of the pattern matches. In the example a ":" not followed by a line number is included in the file name. (suggested by Emanuele Giaquinta) For command-line completion the matches for various types of arguments are now sorted: user commands, variables, syntax names, etc. ============================================================================== COMPILE TIME CHANGES *compile-changes-7* Dropped the support for the BeOS and Amiga GUI. They were not maintained and probably didn't work. If you want to work on this: get the Vim 6.x version and merge it back in. Mac: "make" now creates the Vim.app directory and "make install" copies it to its final destination. (Raf) Mac: Made it possible to compile with Motif, Athena or GTK without tricks and still being able to use the MacRoman conversion. Added the os_mac_conv.c file. When running the tests and one of them fails to produce "test.out" the following tests are still executed. This helps when running out of memory. When compiling with EXITFREE defined and the ccmalloc library it is possible to detect memory leaks. Some memory will always reported as leaked, such as allocated by X11 library functions and the memory allocated in alloc_cmdbuff() to store the ":quit" command. Moved the code for printing to src/hardcopy.c. Moved some code from main() to separate functions to make it easier to see what is being done. Use a structure to avoid a lot of arguments to the functions. Moved unix_expandpath() to misc1.c, so that it can also be used by os_mac.c without copying the code. ============================================================================== BUG FIXES *bug-fixes-7* When using PostScript printing on MS-DOS the default 'printexpr' used "lpr" instead of "copy". When 'printdevice' was empty the copy command did not work. Use "LPT1" then. The GTK font dialog uses a font size zero when the font name doesn't include a size. Use a default size of 10. This example in the documentation didn't work: :e `=foo . ".c" ` Skip over the expression in `=expr` when looking for comments, |, % and #. When ":helpgrep" doesn't find anything there is no error message. "L" and "H" did not take closed folds into account. Win32: The "-P title" argument stopped at the first title that matched, even when it doesn't support MDI. Mac GUI: CTRL-^ and CTRL-@ did not work. "2daw" on "word." at the end of a line didn't include the preceding white space. Win32: Using FindExecutable() doesn't work to find a program. Use SearchPath() instead. For executable() use $PATHEXT when the program searched for doesn't have an extension. When 'virtualedit' is set, moving the cursor up after appending a character may move it to a different column. Was caused by auto-formatting moving the cursor and not putting it back where it was. When indent was added automatically and then moving the cursor, the indent was not deleted (like when pressing ESC). The "I" flag in 'cpoptions' can be used to make it work the old way. When opening a command-line window, 'textwidth' gets set to 78 by the Vim filetype plugin. Reset 'textwidth' to 0 to avoid lines are broken. After using cursor(line, col) moving up/down doesn't keep the same column. Win32: Borland C before 5.5 requires using ".u." for LowPart and HighPart fields. (Walter Briscoe) On Sinix SYS_NMLN isn't always defined. Define it ourselves. (Cristiano De Michele) Printing with PostScript may keep the printer waiting for more. Append a CTRL-D to the printer output. (Mike Williams) When converting a string with a hex or octal number the leading '-' was ignored. ":echo '-05' + 0" resulted in 5 instead of -5. Using "@:" to repeat a command line didn't work when it contains control characters. Also remove "'<,'>" when in Visual mode to avoid that it appears twice. When using file completion for a user command, it would not expand environment variables like for a regular command with a file argument. 'cindent': When the argument of a #define looks like a C++ class the next line is indented too much. When 'comments' includes multi-byte characters inserting the middle part and alignment may go wrong. 'cindent' also suffers from this for right-aligned items. Win32: when 'encoding' is set to "utf-8" getenv() still returns strings in the active codepage. Convert to utf-8. Also for $HOME. The default for 'helplang' was "zh" for both "zh_cn" and "zh_tw". Now use "cn" or "tw" as intended. When 'bin' is set and 'eol' is not set then line2byte() added the line break after the last line while it's not there. Using foldlevel() in a WinEnter autocommand may not work. Noticed when resizing the GUI shell upon startup. Python: Using buffer.append(f.readlines()) didn't work. Allow appending a string with a trailing newline. The newline is ignored. When using the ":saveas f2" command for buffer "f1", the Buffers menu would contain "f2" twice, one of them leading to "f1". Also trigger the BufFilePre and BufFilePost events for the alternate buffer that gets the old name. strridx() did not work well when the needle is empty. (Ciaran McCreesh) GTK: Avoid a potential hang in gui_mch_wait_for_chars() when input arrives just before it is invoked VMS: Occasionally CR characters were inserted in the file. Expansion of environment variables was not correct. (Zoltan Arpadffy) UTF-8: When 'delcombine' is set "dw" only deleted the last combining character from the first character of the word. When using ":sball" in an autocommand only the filetype in one buffer was detected. Reset did_filetype in enter_buffer(). When using ":argdo" and the window already was at the first argument index, but not actually editing it, the current buffer would be used instead. When ":next dir/*" includes many matches, adding the names to the argument list may take an awful lot of time and can't be interrupted. Allow interrupting this. When editing a file that was already loaded in a buffer, modelines were not used. Now window-local options in the modeline are set. Buffer-local options and global options remain unmodified. Win32: When 'encoding' is set to "utf-8" in the vimrc file, files from the command line with non-ASCII characters are not used correctly. Recode the file names when 'encoding' is set, using the Unicode command line. Win32 console: When the default for 'encoding' ends up to be "latin1", the default value of 'isprint' was wrong. When an error message is given while waiting for a character (e.g., when an xterm reports the number of colors), the hit-enter prompt overwrote the last line. Don't reset msg_didout in normal_cmd() for K_IGNORE. Mac GUI: Shift-Tab didn't work. When defining tooltip text, don't translate terminal codes, since it's not going to be used like a command. GTK 2: Check the tooltip text for valid utf-8 characters to avoid getting a GTK error. Invalid characters may appear when 'encoding' is changed. GTK 2: Add a safety check for invalid utf-8 sequences, they can crash pango. Win32: When 'encoding' is changed while starting up, use the Unicode command line to convert the file arguments to 'encoding'. Both for the GUI and the console version. Win32 GUI: latin9 text (iso-8859-15) was not displayed correctly, because there is no codepage for latin9. Do our own conversion from latin9 to UCS2. When two versions of GTK+ 2 are installed it was possible to use the header files from one and the library from the other. Use GTK_LIBDIR to put the directory for the library early in the link flags. With the GUI find/replace dialog a replace only worked if the pattern was literal text. Now it works for any pattern. When 'equalalways' is set and 'eadirection' is "hor", ":quit" would still cause equalizing window heights in the vertical direction. When ":emenu" is used in a startup script the command was put in the typeahead buffer, causing a prompt for the crypt key to be messed up. Mac OS/X: The default for 'isprint' included characters 128-160, causes problems for Terminal.app. When a syntax item with "containedin" is used, it may match in the start or end of a region with a matchgroup, while this doesn't happen for a "contains" argument. When a transparent syntax items matches in another item where the highlighting has already stopped (because of a he= argument), the highlighting would come back. When cscope is used to set the quickfix error list, it didn't get set if there was only one match. (Sergey Khorev) When 'confirm' is set and using ":bdel" in a modified buffer, then selecting "cancel", would still give an error message. The PopUp menu items that started Visual mode didn't work when not in Normal mode. Switching between selecting a word and a line was not possible. Win32: The keypad decimal point always resulted in a '.', while on some keyboards it's a ','. Use MapVirtualKey(VK_DECIMAL, 2). Removed unused function DisplayCompStringOpaque() from gui_w32.c In Visual mode there is not always an indication whether the line break is selected or not. Highlight the character after the line when the line break is included, e.g., after "v$o". GTK: The key can't be mapped, it selects the menu. Disable that with a GTK setting and do select the menu when isn't mapped. (David Necas) After "Y" '[ and '] were not at start/end of the yanked text. When a telnet connection is dropped Vim preserves files and exits. While doing that a SIGHUP may arrive and disturbe us, thus ignore it. (Scott Anderson) Also postpone SIGHUP, SIGQUIT and SIGTERM until it's safe to handle. Added handle_signal(). When using "set laststatus=2 cmdheight=2" in the .gvimrc you may only get one line for the cmdline. (Christian Robinson) Invoke command_height() after the GUI has started up. When completing a file name on the command line backslashes are required for white space. Was only done for a space, not for a Tab. When configure could not find a terminal library, compiling continued for a long time before reporting the problem. Added a configure check for tgetent() being found in a library. When the cursor is on the first char of the last line a ":g/pat/s///" command may cause the cursor to be displayed below the text. Win32: Editing a file with non-ASCII characters doesn't work when 'encoding' is "utf-8". use _wfullpath() instead of _fullpath(). (Yu-sung Moon) When recovering the 'fileformat' and 'fileencoding' were taken from the original file instead of from the swapfile. When the file didn't exist, was empty or the option was changed (e.g., with ":e ++fenc=cp123 file") it could be wrong. Now store 'fileformat' and 'fileencoding' in the swapfile and use the values when recovering. ":bufdo g/something/p" overwrites each last printed text line with the file message for the next buffer. Temporarily clear 'shortmess' to avoid that. Win32: Cannot edit a file starting with # with --remote. Do escape % and # when building the ":drop" command. A comment or | just after a expresion-backtick argument was not recognized. E.g. in :e `="foo"`"comment. "(" does not stop at an empty sentence (single dot and white space) while ")" does. Also breaks "das" on that dot. When doing "yy" with the cursor on a TAB the ruler could be wrong and "k" moved the cursor to another column. When 'commentstring' is '"%s' and there is a double quote in the line a double quote before the fold marker isn't removed in the text displayed for a closed fold. In Visual mode, when 'bin' and 'eol' set, g CTRL-G counted the last line break, resulting in "selected 202 of 201 bytes". Motif: fonts were not used for dialog components. (Marcin Dalecki) Motif: After using a toolbar button the keyboard focus would be on the toolbar (Lesstif problem). (Marcin Dalecki) When using "y`x" where mark x is in the first column, the last line was not included. Not all test scripts work properly on MS-Windows when checked out from CVS. Use a Vim command to fix all fileformats to dos before executing the tests. When using ":new" and the file fits in the window, lines could still be above the window. Now remove empty lines instead of keeping the relative position. Cmdline completion didn't work after ":let var1 var". When using ":startinsert" or ":startreplace" when already in Insert mode (possible when using CTRL-R =), pressing Esc would directly restart Insert mode. (Peter Winters) "2daw" didn't work at end of file if the last word is a single character. Completion for ":next a'" put a backslash before single quote, but it was not removed when editing a file. Now halve backslashes in save_patterns(). Also fix expanding a file name with the shell that contains "\'". When doing "1,6d|put" only "fewer lines" was reported. Now a following "more lines" overwrites the message. Configure could not handle "-Dfoo=long\ long" in the TCL config output. When searching backwards, using a pattern that matches a newline and uses \zs after that, didn't find a match. Could also get a hang or end up in the right column in the wrong line. When $LANG is "sl" for slovenian, the slovak menu was used, since "slovak" starts with "sl". When 'paste' is set in the GUI the Paste toolbar button doesn't work. Clear 'paste' when starting the GUI. A message about a wrong viminfo line included the trailing NL. When 'paste' is set in the GUI the toolbar button doesn't work in Insert mode. Use ":exe" in menu.vim to avoid duplicating the commands, instead of using a mapping. Treat "mlterm" as an xterm-like terminal. (Seiichi Sato) ":z.4" and ":z=4" didn't work Vi compatible. When sourcing a file, editing it and sourcing it again, it could appear twice in ":scriptnames" and get a new , because the inode has changed. When $SHELL is set but empty the 'shell' option would be empty. Don't use an empty $SHELL value. A command "w! file" in .vimrc or $EXINIT didn't work. Now it writes an empty file. When a CTRL-F command at the end of the file failed, the cursor was still moved to the start of the line. Now it remains where it is. When using ":s" or "&" to repeat the last substitute and "$" was used to put the cursor in the last column, put the cursor in the last column again. This is Vi compatible. Vim is not fully POSIX compliant but sticks with traditional Vi behavior. Added a few flags in 'cpoptions' to behave the POSIX way when wanted. The $VIM_POSIX environment variable is checked to set the default. Appending to a register didn't insert a line break like Vi. Added the '>' flag to 'cpoptions' for this. Using "I" in a line with only blanks appended to the line. This is not Vi compatible. Added the 'H' flag in 'coptions' for this. When joining multiple lines the cursor would be at the last joint, but Vi leaves it at the position where "J" would put it. Added the 'q' flag in 'cpoptions' for this. Autoindent didn't work for ":insert" and ":append". Using ":append" in an empty buffer kept the dummy line. Now it's deleted to be Vi compatible. When reading commands from a file and stdout goes to a terminal, would still request the xterm version. Vim can't read it, thus the output went to the shell and caused trouble there. When redirecting to a register with an invalid name the redirection would still be done (after an error message). Now reset "redir_reg". (Yegappan Lakshmanan) It was not possible to use a NL after a backslash in Ex mode. This is sometimes used to feed multiple lines to a shell command. When 'cmdheight' is set to 2 in .vimrc and the GUI uses the number of lines from the terminal we actually get 3 lines for the cmdline in gvim. When setting $HOME allocated memory would leak. Win32: bold characters may sometimes write in another character cell. Use unicodepdy[] as for UTF-8. (Taro Muraoka) ":w fname" didn't work for files with 'buftype' set to "nofile". The method used to locate user commands for completion differed from when they are executed. Abiguous command names were not completed properly. Incremental search may cause a crash when there is a custom statusline that indirectly invokes ":normal". Diff mode failed when $DIFF_OPTIONS was set in the environment. Unset it before invoking "diff". Completion didn't work after ":argdo", ":windo" and ":bufdo". Also for ":set &l:opt" and ":set &g:opt". (Peter Winters) When setting 'ttymouse' to "dec" in an xterm that supports the DEC mouse locator it doesn't work. Now switch off the mouse before selecting another mouse model. When the CursorHold event is triggered and the commands peek for typed characters the typeahead buffer may be messed up, e.g., when a mouse-up event is received. Avoid invoking the autocommands from the function waiting for a character, let it put K_CURSORHOLD in the input buffer. Removed the "COUNT" flag from ":argadd", to avoid ":argadd 1*" to be used like ":1argadd *". Same for ":argdelete" and ":argedit". Avoid that $LANG is used for the menus when LC_MESSAGES is "en_US". Added backslashes before dashes in the vim.1 manual page to make the appear as real dashes. (Pierr Habouzit) Where "gq" left the cursor depended on the value of 'formatprg'. Now "gq" always leaves the cursor at the last line of the formatted text. When editing a compressed file, such as "changelog.Debian.gz" file, filetype detection may try to check the contents of the file while it's still compressed. Skip setting 'filetype' for compressed files until they have been decompressed. Required for patterns that end in a "*". Starting with an argument "+cmd" or "-S script" causes the cursor the be moved to the first line. That breaks a BufReadPost autocommand that uses g`". Don't move the cursor if it's somewhere past the first line. "gg=G" while 'modifiable' is off was uninterruptable. When 'encoding' is "sjis" inserting CTRL-V u d800 a few times causes a crash. Don't insert a DBCS character with a NUL second byte. In Insert mode CTRL-O didn't move the cursor. Made "ins_at_eol" global and reset it in nv_home(). Wildcard expansion failed: ":w /tmp/$$.`echo test`". Don't put quotes around spaces inside backticks. After this sequence of commands: Y V p gv: the wrong line is selected. Now let "gv" select the text that was put, since the original text is deleted. This should be the most useful thing to do. ":sleep 100u" sleeps for 100 seconds, not 100 usec as one might expect. Give an error message when the argument isn't recognized. In gui_mch_draw_string() in gui_w32.c "unibuflen" wasn't static, resulting in reallocating the buffer every time. (Alexei Alexandrov) When using a Python "atexit" function it was not invoked when Vim exits. Now call Py_Finalize() for that. (Ugo Di Girolamo) This breaks the thread stuff though, fixed by Ugo. GTK GUI: using a .vimrc with "set cmdheight=2 lines=43" and ":split" right after startup, the window layout is messed up. (Michael Schaap) Added win_new_shellsize() call in gui_init() to fix the topframe size. Trick to get ...MOUSE_NM not used when there are vertical splits. Now pass column -1 for the left most window and add MOUSE_COLOFF for others. Limits mouse column to 10000. searchpair() may hang when the end pattern has "\zs" at the end. Check that we find the same position again and advance one character. When in diff mode and making a change that causes the "changed" highlighting to disappear or reappear, it was still highlighted in another window. When a ":next" command fails because the user selects "Abort" at the ATTENTION prompt the argument index was advanced anyway. When "~" is in 'iskeyword' the "gd" doesn't work, it's used for the previous substitute pattern. Put "\V" in the pattern to avoid that. Use of sprintf() sometimes didn't check properly for buffer overflow. Also when using smsg(). Included code for snprintf() to avoid having to do size checks where invoking them ":help \=" didn't find "sub-replace-\=". Wild menu for help tags didn't show backslashes. ":he :s\=" didn't work. When reading an errorfile "~/" in a file name was not expanded. GTK GUI: When adding a scrollbar (e.g. when using ":vsplit") in a script or removing it the window size may change. GTK sends us resize events when we change the window size ourselves, but they may come at an unexpected moment. Peek for a character to get any window resize events and fix 'columns' and 'lines' to undo this. After deleting files from the argument list a session file generated with ":mksession" may contain invalid ":next" commands. When 'shortmess' is empty and 'keymap' set to accents, in Insert mode CTRL-N may cause the hit-enter prompt. Typing 'a then didn't result in the accented character. Put the character typed at the prompt back in the typeahead buffer so that mapping is done in the right mode. setbufvar() and setwinvar() did not give error messages. It was possible to set a variable with an illegal name, e.g. with setbufvar(). It was possible to define a function with illegal name, e.t. ":func F{-1}()" CTRL-W F and "gf" didn't use the same method to get the file name. When reporting a conversion error the line number of the last error could be given. Now report the first encountered error. When using ":e ++enc=name file" and iconv() was used for conversion an error caused a fallback to no conversion. Now replace a character with '?' and continue. When opening a new buffer the local value of 'bomb' was not initialized from the global value. Win32: When using the "Edit with Vim" entry the file name was limited to about 200 characters. When using command line completion for ":e *foo" and the file "+foo" exists the resulting command ":e +foo" doesn't work. Now insert a backslash: ":e \+foo". When the translation of "-- More --" was not 10 characters long the following message would be in the wrong position. At the more-prompt the last character in the last line wasn't drawn. When deleting non-existing text while 'virtualedit' is set the '[ and '] marks were not set. Win32: Could not use "**/" in 'path', it had to be "**\". The search pattern "\n" did not match at the end of the last line. Searching for a pattern backwards, starting on the NUL at the end of the line and 'encoding' is "utf-8" would match the pattern just before it incorrectly. Affected searchpair('/\*', '', '\*/'). vim:tw=78:ts=8:ft=help:norl: