*version7.txt*  For Vim version 7.0aa.  Last change: 2005 Jan 14


		  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.

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|

New data types				|new-data-types|
KDE support				|new-KDE|
Translated manual pages			|new-manpage-trans|
Internal grep				|new-vimgrep|
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

":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'

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.

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".


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" 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 <F10> key depended on 'winaltkeys'.  Now it depends
on whether <F10> has been mapped or not.  This allows mapping <F10> 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.

==============================================================================
NEW FEATURES						*new-7*

New data types						*new-data-types*
--------------

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 Dictionary is NOT IMPLEMENTED YET!

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.


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
Italian (translated by Antonio Colombo).  More languages will follow.

The Unix Makefile installs the Italian manual pages in .../man/it/man1/.


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|.


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)

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)


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)

New functions: ~

browsedir(title, init)	|browsedir()|	Dialog to select a directory.
byteidx(expr, nr)	|byteidx()| 	Index of a character. (Ilya Sher)
finddir(name)		|finddir()|	Find a directory in 'path'.
findfile(name)		|findfile()|	Find a file in 'path'. (Johannes
					Zellner)
foldtextresult(lnum)	|foldtextresult()|  The text displayed for a closed
					fold at line "lnum".
getfperm(fname)		|getfperm()|	Get file permission string. (Nikolai
					Weibull)
getftype(fname)		|getftype()|	Get type of file. (Nikolai Weibull)
repeat(expr, count)	|repeat()| 	Repeat "expr" "count" times.
					(Christophe Poucet)
tr(expr, from, to)	|tr()|		Translate characters. (Ron Aaron)
system(cmd, input)	|system()|	Filters {input} through a shell
					command.
getfontname([name])	|getfontname()| Get actual font name being used.


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


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)


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)


New Keymaps: ~

Sinhala (Sri Lanka) (Harshula Jayasuriya)


New message translations: ~

The Ukranian messages are now also available in cp1251.


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)

GUI font selector 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)

The netrw plugin now also supports viewing a directory, when "scp://" is used.
Deleting and renaming files is possible.  (Charles Campbell)

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)

==============================================================================
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.

":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.

==============================================================================
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.

==============================================================================
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.

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.

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 <F10> key can't be mapped, it selects the menu.  Disable that with a
GTK setting and do select the menu when <F10> 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<C-V>`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<Tab>".

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'<Tab>" put a backslash before single quote, but it was
not removed when editing a file.  Now halve backslashes in save_patterns().

 vim:tw=78:ts=8:ft=help:norl:
