- The VI Pages Latest Change: Thu Jan 01 01:00:00
__   __ ___
\ \ / /|_ _|
 \ V /  | |
  \_/  |___|
and many more!
HOME -- | Answers | Availability | Books | Bugs | Clones | Definition | Docs | History | Press | Quotes -- Clones: HomePages -- More than Text: Buttons | Pictures -- This+That: Folklore | Merchandise -- Meta Pages: Credits | Mirrors | News | Todo -- Special Pages: | Intro | Signatures | Substitution Guide | Unix Distributions | War (Holy)

Vi Pages - Bugs

Known bugs with "Vanilla Vi", ie the "copyrighted" Vi versions.

NOTE: This page is not about bugs for vi clones; the vi clones usually have a webpage, free source code, and supporters, so bugs usually get squashed pretty soon. It simply makes no sense to keep descriptions of their old bugs around.

BUG: ":write bar" cancels the modified flag

NOTE: Every Vi user should be aware of this bug!

Assume you started vi with "vi foo". Make some changes. Save the changes to the file with ":w" if you like.

Make some more changes. But this time, before you write the buffer to the file again (eg with ":w") make an intermediate "backup" to some other file, say, to file "bar", ie use command ":w bar".

The bug is that vi cancels the modified flag on the current buffer as if you had done ":w" and foo were updated with the changes.

So when you leave vi at that point with a write command (":x", ":wq", or "ZZ") vi will NOT write the buffer to the file foo as the "modified" flag is (incorrectly) OFF - even though you *have* made changes to its copy in the edit buffer. :-(

NOTE: This frequently happens to people who use vi to write a mail (or a post) and use ":w foo.copy" to save a copy of the mail. When they send off the mail after exiting vi they thus send off the version that was last saved before the extra copy. And if they never saved the mail during the edit session then they send off an empty mail. :-(

Thanks to David W. Tamkin for explaining this to me!

BUG: No "Yank" in "Global/Macro"

Michael Gurfinkel [001128]: SCO OpenServer 5.0.5, vi version SVR3.1 "The map command map ^F ea_^[b"gye when executed as a macro results in the message :Can't yank inside Global/Macro."

Bug or feature? You decide.

BUG: Solaris Vi segfaults on special chars in filename

Aaro Koskinen 990215:
"on older Solaris versions (Version SVR4.0, Solaris 2.5.0), you
get easily segmentation fault with bad input, e.g. try ":f^V^M^M")."


Non-Feature: Vi does not accept data from stdin

[980114] VI does not accept data from stdin. Example:
        echo foo | vi
Here you would expect VI to open a buffer with "foo" in it. But eg Vi-SVR3 exits with the message "Input read error". :-(

However, Vi Clones do accept data from stdin. Example:

        echo foo | vim -

BUG: Missing Number Prefix for some Commands

Vi commands usually can be used repeatedly by typing in a "number prefix" before the commands. This number is known as a "number prefix" (and sometimes referred to as "repetiton number").

However, Vi does not allow a number prefix for these commands:

        /       search forward
        ?       search backward
        n       search for next occurrence of last used search pattern
                in same search direction
        N       search for next occurrence of last pattern
                in opposite search direction
        p       put contents of unnamed register after  current char/line
        p       put contents of unnamed register before current char/line


Preparation: Enter a line with "foo" with the command "ofooESC". Now copy the line with 'Y' and try to put two copies after it with "2p".

Result: Only one copy will be inserted - instead of two.

Workaround: Use the "ex command" (aka "command line") to "put" as it can take a number prefix. You can apply this to an "global" command, too.


This command jumps to line L, makes M copies of it, and puts them after line N.

Remark: Thank God this is fixed with vi clones! :-)

BUG: SVR3.1 - Repetition of 'i'nsert commands fails

Vi-SVR3.1: The number prefix you can give to the insert command 'i' only works unto the end of the first line.

Example: The command

will make Vi apply the '2' only for the line "abc" - and immediately after pressing ^M. However, the number prefix then is considered to "has been used" and will thus not be used for further text. So the line with "xyz" will not be duplicated.



BUG: Empty Lines in setup file "exrc"

Vi stops reading the setup file ("exrc") at the first empty line. Or so it seems.

When Vi-SVR3.1 starts up on an exrc with an empty line you get the error message "No lines in the buffer" twice.

Fix: Do NOT use empty lines in your exrc! ;-)

Workaround: Put a '"' at the beginning of the line instead thus making the line a comment. You can insert an empty line to disable the rest of the exrc on purpose, of course. ;-)

Now, the weird thing is that when you explicitly read in the setup file, eg with ":source .exrc" then the line after the empty *will* be processed.

Thanks to Jason Carr for the hint on this.

BUG: Change to line marked with 'd'

[970126] Affected Versions:
SunOS:         Version SVR3.1
Solaris 2.5.0: Version SVR4.0
Digital Unix:  Revision:  $ $Date: 1993/06/10 19:42:30 $
Digital Unix:  Revision: $ $Date: 1995/06/12 19:52:40 $
    AIX 4.1.x: no error
   HP-UX 8.00: no error
info by Matthias Buelow

Command sequence: mdoESCc'd

Result: Makes Vi segfault.

Reported by: W-J. Kasdorp on comp.editors [970121]

BUG: Yanking to Matching Item followed by a Put

Command sequence: y%jp

For this command sequence to work there must be a match for the command % . This needs some preparation:

  1. Create a file with just the following two lines: for( ;; ) /* unconditional loops are a bad thing... */ { /*NOTHING*/ } /* ...especially those which don't do anything */
  2. Position the cursor over the "f" in for.
  3. Type "y%" to yank just the "for( ;; )" into the default buffer.
  4. Type "j" to move to the start of the following line.
  5. Type "p" to insert.
  6. Vi SVR3.1 inserts '{' - not "for( ;; )". BUG!
Diagnostic: In VI when yanking through % where the match is on the same line VI is left in an intermediate state with respect to the yank. Thus a "put" fails:

"I have verified this bug on a number of standard implmentations including Solaris, HP/UX, DG/UX, Unixware, and others I can't recall right now. VIM does not have the same behavior as VI in this instance."

Submitted by: Jonathan A. George

Possible BUG: DGUX Vi vs curses?

Aaro Koskinen 990215: "DGUX vi (Revision: $ $Date: 1997/08/19 08:56:09 $) has a nasty habit to segfault when a line exceeds a certain limit, eg when appending N characters with N=$COLUMNS * ($LINES - 1)). Might be a curses bug, though."


Vi - Bug Spotting

If you have any material on Vi Bugs then then please send them to me at
  • thanks!

    Please include the version info with any reports, ie the string given by the command ":version" (":ver"). Thanks!

    Sven Guckes <> HOME Mirrors: AU | CA | ZA add mirror?