Errata

Learning the vi and Vim Editors

Errata for Learning the vi and Vim Editors, Seventh Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
PDF
Page 3
chapter 1 1st paragraph 3rd sentence

Text editors based on the X Window System are also commonly available and are becoming increasing popular.

should be

Text editors based on the X Window System are also commonly available and are becoming increasingly popular.

Note from the Author or Editor:
as entered by reader, in sentence above, change word:
"increasing"
to:
"increasingly"

Anonymous  Mar 21, 2010 
Printed
Page 5
2nd para

One or two characters are used for the basidIp commands.
should be:
One or two characters are used for the basic commands.

ron wickersham  Jul 04, 2009 
Printed
Page 33
table 2-4

"Editing Action" for "Command" `A' is wrong:

Append text at beginning of line

It shoud read

Append text at end of line

instead.

Anonymous  Nov 12, 2008 
Printed
Page 33
Table 2-4, line 4

Text says "A will cause append at beginning of line". Shouldn't this be "A will cause append at end of line"? (At least my VIM 7.2 on Windows works that way.)

Note from the Author or Editor:
the reviewer's comments are correct.

change the table entry text for the entry "A" (capital A) from:

Append text at beginning of line

to:

Append text to end of line

Thomas Spence  Mar 01, 2009 
Printed
Page 36
First example of the "z" command in the "Repositioning the Screen with z" section


Very minor.

The examples for z call out "Enter", ".", and "-". For completeness(symmetry?), I would suggest noting that "+" is a synonym for "Enter".

Note from the Author or Editor:
change the entry for:
z [ENTER]

by additionally adding:
z+

resulting in:

z[ENTER]
z+

Anonymous  Aug 11, 2008 
Printed
Page 38
Text under second example in the "Movement on the current line" section


A nit, really.

The "n|" will just move to the end of the line (as opposed to adding spaces to the end) if the number, "n", is greater than the number of characters on the line.

I suppose this should be obvious but it does surprise some when they encounter it for the first time.

Anonymous  Aug 11, 2008 
Printed
Page 50
Fifth line of text


The text states two ways to override the view mode by adding an exclamation point to the write command.

The second example should be followed by the punctuation. It should be ":wq!", not ":wq"

Anonymous  Aug 11, 2008 
Printed
Page 59
last line

:/pattern/=
Print the line number of the first line that matches *pattern*.

should be changed to:

Print the line number of the next line that matches *pattern*.

(first --> next)

Anonymous  Dec 31, 2009 
PDF
Page 75
Near bottom of page above the note with the tracks. Last sentence 2nd para in [ ]

This is a minor technical mistake. The example in the sentence below is technically wrong. There is a space between the ().

For example, [:;A-Za-z( )] will match four different punctuation marks, plus all letters.

so it should be:

For example, [:;A-Za-z()] will match four different punctuation marks, plus all letters.

or

For example, [:;A-Za-z( )] will match four different punctuation marks, and spaces plus all letters.

Note from the Author or Editor:
change:


For example, [:;A-Za-z( )] will match four different punctuation marks, plus all letters.

to:


For example, [:;A-Za-z()] will match four different punctuation marks, plus all letters.

Anonymous  Apr 04, 2010 
Printed
Page 79
top line

petty, but you spelled Yaz' name wrong.


:%s/Yazstremski/&, Carl/

should be

:%s/Yastrzemski/&, Carl/

Note from the Author or Editor:
make change as submitted by reader.

Gary Pieper  May 14, 2010 
Printed
Page 85 f.
Examples 12 and 13

While the problem with example 12 is that the given solution is just not optimal, the problem with example 13 is that the given solution is wrong.


Example 12
----------
Using

:%s/^ *//

instead would achieve the same task faster and IMHO cleaner.


Example 13
----------
The given solution

:%s/\(.*\) *$/\1/

does _not_ delete all spaces at the end of every line; since * is a greedy quantifier and the regex is parsed left to right, only one space at the end is deleted.

My favourite solution would be

:%s/ *$//

instead.

Note from the Author or Editor:
reader is correct, the example 13 should be corrected per his/her instructions as example 13 is wrong.

reader is also correct that in his/her opinion the suggested alternate substitution is cleaner. however, since example 12 is ostensibly correct (it does what it says it does), leave that one unchanged.

Anonymous  Nov 18, 2008 
PDF
Page 108
top of page 108, end of map example from page 107

2 Transpose two words:

:map K dwElp

We discussed this sequence earlier in the chapter, but now you need to use E (assume here, and in the remaining examples, that the e command is mapped to ea). Remember that the cursor begins on the first of the two words. Unfortunately, because of the l command, this sequence (and the earlier version) doesn't work if the two words are at the end of a line: during the sequence, the cursor ends up at the end of the line, and l cannot move further right. Here's a better solution:

:map K dwwP

You could also use W instead of w.

Unless I missed something this last example :map K dwwP does not work as intended. The sentence above implies that this will solve swapping two words when they are at the end of the row.

one three two

the two is at the very end and there is no space to the right.

running dwwP or dwWP or dWwP or dWWP

Results in "three two" becoming "twthree o"

running dwwp or dwWp or dWwp or dWWp

Results in "three two" becoming "twothree"

I have not been able to find a correct solution without going into insert mode and adding a space. Unless you have a solution, the example and the last sentence above the example and the sentence below it need to be removed.

Note from the Author or Editor:
in the errata submitted this text:

Unfortunately, because of the l command, this sequence (and the earlier version) doesn't work if the two words are at the end of a line: during the sequence, the cursor ends up at the end of the line, and l cannot move further right. Here's a better solution:



:map K dwwP



You could also use W instead of w.

should be replaced with:

Unfortunately, because of the l command, this sequence (and the earlier version) doesn't work if the two words are at the end of a line: during the sequence, the cursor ends up at the end of the line, and l cannot move further right.

stosss  Apr 11, 2010 
PDF
Page 129
First paragraph of "Exuberant ctags" section

The text says: "Its home page is http://ctags.sourceforget.net/."

The URI is wrong. It should be http://ctags.sourceforge.net/.

Note from the Author or Editor:
change:


Its home page is http://ctags.sourceforget.net/.

to


Its home page is http://ctags.sourceforge.net/.

Aaron Beckerman  Aug 02, 2010 
Printed
Page 137
table 8-7

For vim (and probably vor elvis, but I can't check ATM) the description of the action is wrong:

``... When set, long lines simply go off the edge of the screen. ...''

This should read:

``... When unset, long lines simply go off the edge of the screen. ...''

Note: set vs. unset.

Note from the Author or Editor:
verified this behavior as described in reviewer's comments for vim.

change "When set" in the vim table entry to "When unset"

Anonymous  Nov 26, 2008 
PDF
Page 147
4th paragraph

"A casual inspection of this directory (using the standard Unix word count tool, wc -c *.txt) shows 129 files comprising almost 122,000 lines of documentation!"

I believe the command used to obtain the line count was "wc -l *.txt".

Note from the Author or Editor:
erratum confirmed, change:

"A casual inspection of this directory (using the standard Unix word count tool, wc -c *.txt) shows 129 files comprising almost 122,000 lines of documentation!

to:

"A casual inspection of this directory (using the standard Unix word count tool, wc -l *.txt) shows 129 files comprising almost 122,000 lines of documentation!

Jacob Budin  Mar 05, 2013 
PDF
Page 149
Under "Postprocessing"

The paragraph ends with "You have complete control to customize any postedit activities". There should be a period at the end.

Note from the Author or Editor:
change to:

You have complete control to customize any postedit activities.

Aaron Beckerman  Aug 02, 2010 
Printed
Page 175
Figure 11-1

The caption of Figure 11-1 on page 175 should be changed to 'Results of "Vim -o file1 file2"' instead of 'Results of "Vim -o5 file1 file2"'.

On the other hand, Figure 11-2 on page 176 has the correct caption: "Vim -o5 file1 file2".

Note from the Author or Editor:
make change as submitted by reader.

Andreas Grech  Jun 28, 2010 
Printed
Page 179
heading for third paragraph

This may be more serious, but the paragraph heading indicates a discussion of "Conditional Split Commands" -- plural. The paragraph only discusses the ':topleft cmd' command. (Although the ':vertical' command is alluded to in a table on page 186, it is not discussed here.)

Anonymous  Jul 31, 2008 
Printed
Page 179
heading for third paragraph

This may be more serious, but the paragraph heading indicates a discussion of "Conditional Split Commands" -- plural. The paragraph only discusses the ':topleft cmd' command. (Although the ':vertical' command is alluded to in a table on page 186, it is not discussed here.)

Note from the Author or Editor:
after three bullets in "Conditional Split Commands" section on page 179, add the clarifying paragraph:

In addition the the conditional split command ":topleft", vim offers analogously the commands: ":leftabove", ":rightbelow", ":botright", and ":vertical". Find detailed descriptions on their use with Vim's ":help" command.

Anonymous   
Printed
Page 181
Table 11-2 Window navigation commands

In the fourth item from the bottom of the table, the capital W is missing from the 'Ctrl-W W' command (move to next window above or to the left).

Anonymous  Jul 31, 2008 
Printed
Page 181
Table 11-2 Window navigation commands

In the fourth item from the bottom of the table, the capital W is missing from the 'Ctrl-W W' command (move to next window above or to the left).

Note from the Author or Editor:
change line described by reader from:

CTRL-W

to

CTRL-W W

Anonymous   
PDF
Page 184
Second note

The note begins: "One of the authors? favorite ways to use the CTRL-W + and CTRL-W - commands is by mapping each to keys, both keys adjacent. The + key is a convenient choice. Though it is already the Vim 'up' command, that behavior is redundant and little used by veteran Vim users (who use the k command instead)."

There are two problems with this. + does not move the cursor up a line; it moves the cursor to the first non-blank character on the line BELOW. Therefore, + is not equivalent to the k command; it is equivalent to the j^ command sequence.

Note from the Author or Editor:
submitter is correct, the '-' key is a nuanced different behavior in that not only does it move cursor up one line, but also moves cursor to first non-blank char in line.

I consider it very minor but there could be a parenthentic sentence (though I'm not sure I recommend it).

change:

Though it is already the Vim 'up' command, that behavior is redundant and little used by veteran Vim users (who use the k command instead)."

to
Though it is already the Vim 'up' command, that behavior is redundant and little used by veteran Vim users (who use the k command instead)." (NOTE: the '-' key does, in addition to moving cursor one line up, also moves cursor to first non-blank char in that line -- this is a slightly different behavior than 'k' key.)

Aaron Beckerman  Aug 04, 2010 
Printed
Page 190
Top of page - in bottom of table 11-8 - just above :bmod & :sbmod listing

In table 11-8, the commands to "Move to last buffer" are given as
:bfirst
:sbfirst

(These are listed in two places, correctly for the first instance, but incorrectly for the second instance.)

Note from the Author or Editor:
the entry on p190 where description is "Move to last buffer..." should have its left-hand-side changed from:
:bfirst
:sbfirst

to:
:blast
:sblast

Anonymous  Aug 17, 2008 
Printed
Page 191
second paragraph

Both of the first two paragraphs on this page purport to describe the 'Ctrl-W g f' command, but I believe the second one meant to be the 'Ctrl-W g F' command instead.

Anonymous  Jul 31, 2008 
Printed
Page 191
second paragraph

Both of the first two paragraphs on this page purport to describe the 'Ctrl-W g f' command, but I believe the second one meant to be the 'Ctrl-W g F' command instead.

Note from the Author or Editor:
beginning of second paragraph change

^Wgf

to

^WgF

Anonymous   
Printed
Page 205
fourth paragraph (actually a paragraph seems to be missing!)

In the array version of the 'SetTimeOfDayColors()' script, everything is going along okay until the code itself is put forth. There are suddenly two lines of code that are not explained in any way -- not even to say they are beyond the scope of this book. From a group that explain other codes in such detail as in the 'LastMod()' example on page 214, something seems to be amiss. The reader is left to wonder where 'echo' and'redraw' are.

Note from the Author or Editor:
the two lines:

echo "execute " "colorscheme" . g:Favcolorschemes[g:CurrentHour]
redraw

are indeed not commented on or documented. While not technically beyond scope, the lines are not important to the intent of the script and if we were to offer clarification, I agree we could add this small paragraph after the code block:

The "echo..." statement prints the information and "announces" the change that just occurred from the script actions. The "redraw" line tells Vim to redraw the screen immediately.

Anonymous   
Printed
Page 208
Figure 12-3 File type of new file detected AND fourth paragraph

The '!' in '#!/bin/sh' is invisible in the grey-scale image of the figure. It is just plain missing in the discussion of this figure in the fourth paragraph. (But it is in the input instructions from paragraph 2!)

Note from the Author or Editor:
in paragraph 4 on page 208, that begins: "You can tell from the picture...", change:

"does not show that # /bin/sh is blue"

to:

"does not show that #!/bin/sh is blue"

Anonymous  Jul 31, 2008 
Printed
Page 208
Figure 12-3 File type of new file detected AND fourth paragraph

The '!' in '#!/bin/sh' is invisible in the grey-scale image of the figure. It is just plain missing in the discussion of this figure in the fourth paragraph. (But it is in the input instructions from paragraph 2!)

Anonymous   
Printed
Page 243
line 12

"3zf executes the zF.." should be "3zF executes the zF.."

Note from the Author or Editor:
errata confirmed...

change:
3zf executes the zF

to:
3zF executes the zF

Orfeo  Jun 16, 2013 
Printed
Page 246
Center of the tip box

set foldcolumns=n
should be
set foldcolumn=n

BTW, the short form of foldcolumn, fdc

Note from the Author or Editor:
submitter is correct:
page 246, center of tip box, line:

set foldcolumns=n

should be:

set foldcolumn=n

Ma Xiaojun  Aug 14, 2011 
PDF
Page 247
3rd paragraph

Type ~~ (toggle case for all characters in the current line).

should read:

Type g~~ (toggle case for all characters in the current line).

Note from the Author or Editor:
change:
Type ~~ (toggle case for all characters in the current line).

to:
Type ~~ (toggle case for all characters in the current line). (Note that this is the usage for changing case in line when vim option "tildeop" is set, otherwise the command would be "g~~".)

Nicholas Moe  Jul 10, 2014 
Printed
Page 249
Last paragraph, first sentence.

``First, make sure to get rid of all folds by typing zD [...]''

This should be zE instead of zD.

Anonymous  Dec 03, 2008 
Printed
Page 385
Line 6, beginning from g*

Original:
g* Search backward for .......

Correct:(Tested with VIM)
g* Search FORWARD for .......

Note from the Author or Editor:
submitted error description is correct.

correction is also correct. (though I'm sure they don't mean for "FORWARD" to be all caps, but did so for emphasis.)

Anonymous  Sep 16, 2008 
Printed
Page 421
'backspace' description

Written :
"Values are: 0 for vi compatibility; 1 to backspace over newlines; and 2 to backspace over the start of insert.
Using a value of 3 allows both."

Actually not. There are 3 options for backspace option, which are 0, 1 and 2.
We should read :
"Values are: 0 for vi compatibility; 1 to backspace over newlines and indents; and 2 to backspace over the start of insert, newlines and indents."
There is no "3" value.

Note from the Author or Editor:
replace:
"Values are: 0 for vi compatibility; 1 to backspace over newlines; and 2 to backspace over the start of insert."
with:
"Values are: 0 for vi compatibility; 1 to backspace over newlines and indents; and 2 to backspace over the start of insert, newlines and indents."

Anonymous  Nov 09, 2008 
Other Digital Version
436
Last paragraph

I'm Antonio Valle, the creator of the vi Powered! logo, in year 1996. I then created the Proud to Use VI page, and it was once hosted in the URL http://www.abast.es/~avalle/vi.html but we loose it in a system crash with no backups.

I just wanted to clarify that the URL in the book is incorrect, and would be very proud to appear as the original creator of the logo.

Thanks!
Antonio Valle

PS: You can confirm this information in the Darryl website, where he still has the copy of the original page (translated into english) at http://www.darryl.com/viold.html

Note from the Author or Editor:
I verified the url of the old page. In the book we do not attribute the creator but simply reference the location of the vi logo gif.

change first sentence in said paragraph from:

The original home page for the vi Powered logo was http://www.abast.es/~avelle/vi.html.

to:

The original home page for the vi Powered (created by Antonio Valle) logo was http://www.abast.es/~avelle/vi.html.

Antonio Valle  Jan 07, 2009 
Printed
Page 443
The Towers of Hanoi, vi Version

The ``map A'' command has no righthandside in the given code. It should probably read

map A "fyl

instead.

Jukka Salmi  Dec 09, 2008