ba2b338cf6d5

Merge.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 08 Sep 2012 13:45:05 -0400
parents 11b6950a211e (current diff) 7a638cd48d48 (diff)
children 6baa30c3b7d3
branches/tags (none)
files chapters/16.markdown

Changes

--- a/.hgignore	Tue Apr 24 14:30:05 2012 +0100
+++ b/.hgignore	Sat Sep 08 13:45:05 2012 -0400
@@ -8,3 +8,4 @@
 .ropeproject
 tags
 build
+venv
--- a/acknowledgements.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/acknowledgements.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -7,3 +7,4 @@
 * [Psycojoker](https://github.com/Psycojoker)
 * [manojkumarm](https://github.com/manojkumarm)
 * [dmedvinsky](https://github.com/dmedvinsky)
+* [flatcap](https://github.com/flatcap)
--- a/chapters/03.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/03.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -11,18 +11,18 @@
 Type a few lines of text into a file, then run:
 
     :::vim
-    :map \ x
+    :map - x
 
-Put your cursor somewhere in the text and press `\`.  Notice how Vim deleted the
+Put your cursor somewhere in the text and press `-`.  Notice how Vim deleted the
 character under the cursor, just like if you had pressed `x`.
 
 We already have a key for "delete that character under the cursor", so let's
 change that mapping to something slightly more useful.  Run this command:
 
     :::vim
-    :map \ dd
+    :map - dd
 
-Now put your cursor on a line somewhere and press `\` again.  This time Vim
+Now put your cursor on a line somewhere and press `-` again.  This time Vim
 deletes the entire line, because that's what `dd` does.
 
 Special Characters
--- a/chapters/05.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/05.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -90,7 +90,7 @@
 character.
 
 Each of the `*map` commands has a `*noremap` counterpart that ignores other
-mappings: `nnoremap`, `vnoremap`, and `inoremap`.
+mappings: `noremap`, `nnoremap`, `vnoremap`, and `inoremap`.
 
 When to Use
 -----------
@@ -102,7 +102,7 @@
 
 **No, seriously, ALWAYS.**
 
-Using a bare `nmap` is just *asking* for pain down the road when you install
+Using a bare `*map` is just *asking* for pain down the road when you install
 a plugin or add a new custom mapping.  Save yourself the trouble and type the
 extra characters to make sure it never happens.
 
--- a/chapters/06.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/06.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -8,11 +8,11 @@
 `<space>` normally does.  What if we need that key later?
 
 There are a bunch of keys that you don't normally need in your day-to-day Vim
-usage.  `\` doesn't do anything.  `-`, `H`, `L`, and `<space>` do things that
-you almost never need.  Depending on how you work you may find others that you
-never use.
+usage.  `-`, `H`, `L`, `<space>`, `<cr>`, and `<bs>` do things that you almost
+never need (in normal mode, of course).  Depending on how you work you may find
+others that you never use.
 
-Those are safe to map, but that only gives us five keys to work with.  What
+Those are safe to map, but that only gives us six keys to work with.  What
 happened to Vim's legendary customizability?
 
 Mapping Key Sequences
--- a/chapters/07.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/07.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -19,7 +19,7 @@
 Editing Mapping
 ---------------
 
-Lets add a mapping that will open our `~/.vimrc` file in a split so we can edit
+Let's add a mapping that will open our `~/.vimrc` file in a split so we can edit
 it and get back to coding.  Run this command:
 
     :::vim
--- a/chapters/08.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/08.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -89,7 +89,7 @@
 Run this command:
 
     :::vim
-    :inoremap ssig --<cr>Steve Losh<cr>steve@stevelosh.com
+    :inoremap ssig -- <cr>Steve Losh<cr>steve@stevelosh.com
 
 This is a *mapping* intended to let you insert your signature quickly.  Try it
 out by entering insert mode and typing `ssig`.
@@ -109,7 +109,7 @@
 
     :::vim
     :iunmap ssig
-    :iabbrev ssig --<cr>Steve Losh<cr>steve@stevelosh.com
+    :iabbrev ssig -- <cr>Steve Losh<cr>steve@stevelosh.com
 
 Now try out the abbreviation again.
 
--- a/chapters/09.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/09.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -20,7 +20,7 @@
 after the `j`, Vim decides that you don't want to activate the mapping and
 instead runs the normal `j` functionality (moving down a line).
 
-This mapping will make it painful to move around our file, so lets remove it.
+This mapping will make it painful to move around our file, so let's remove it.
 Run the following command:
 
     :::vim
@@ -76,8 +76,8 @@
 instead of double quotes.
 
 Try using `vnoremap` to add a mapping that will wrap whatever text you have
-*visually selected* in quotes.  You'll probably need the `gv` command for this,
-so read up on it with `:help gv`.
+*visually selected* in quotes.  You'll probably need the ```<`` and ```>``
+commands for this, so read up on them with ``:help `<``.
 
 Map `H` in normal mode to go to the beginning of the current line.  Since `h`
 moves left you can think of `H` as a "stronger" `h`.
--- a/chapters/10.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/10.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -32,6 +32,9 @@
   you exactly where you started.  Using `jj` in normal mode will move you to
   a different place in your file.
 
+If you write in a language where `jk` is a frequently used combination of
+letters (like Dutch) you'll probably want to pick a different mapping.
+
 Learning the Map
 ----------------
 
--- a/chapters/11.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/11.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -32,11 +32,16 @@
 
 Now for the twist: while still in file `bar` type `<leader>x`.
 
-Nothing happened!
+Instead of deleting the entire line, Vim just deleted a single character!
+What happened?
 
 The `<buffer>` in the second `nnoremap` command told Vim to only consider that
 mapping when we're in the same buffer as where we defined it.
 
+When you typed `<leader>x` in file `bar` Vim couldn't find a mapping that
+matched it, so it treated it as two commands: `<leader>` (which does nothing on
+its own) and `x` (the normal command to delete a single character.)
+
 Local Leader
 ------------
 
@@ -97,7 +102,7 @@
     :nnoremap <buffer> Q x
     :nnoremap          Q dd
 
-Now switch to file `foo` and type `Q`.  What happens?
+Now type `Q`.  What happens?
 
 When you press `Q`, Vim will run the first mapping, not the second, because the
 first mapping is *more specific* than the second.
--- a/chapters/13.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/13.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -41,7 +41,7 @@
 
 Create a few more "snippet" abbreviations for some of the things you type often
 in specific kinds of files.  Some good candidates are `return` for most
-languages, `function` for javascript, and thinks like `&ldquo;` and `&rdquo;`
+languages, `function` for javascript, and things like `&ldquo;` and `&rdquo;`
 for HTML files.
 
 Add these snippets to your `~/.vimrc` file.
--- a/chapters/14.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/14.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -107,8 +107,8 @@
 Now try writing your file and checking `:messages`.  This time Vim only echoed
 "Cats" when you wrote the file.
 
-Using in Your Vimrc
--------------------
+Using Autocommands in Your Vimrc
+--------------------------------
 
 Now that we know how to group autocommands and clear those groups, we can use
 this to add autocommands to `~/.vimrc` that don't add a duplicate every time we
--- a/chapters/15.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/15.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -100,11 +100,11 @@
 Put your cursor somewhere in the word "print" and type `cin(`.  Vim will delete
 the contents of the parentheses and place you in insert mode between them.
 
-You can think of this mapping as meaning "inside next parenthesis", and it will
-perform the operator on the text inside the next set of parenthesis on the
+You can think of this mapping as meaning "inside next parentheses", and it will
+perform the operator on the text inside the next set of parentheses on the
 current line.
 
-Let's make a companion "inside last parenthesis" ("previous" would be a better
+Let's make a companion "inside last parentheses" ("previous" would be a better
 word, but it would shadow the "paragraph" movement).  Run the following command:
 
     :::vim
@@ -153,8 +153,8 @@
 Exercises
 ---------
 
-Create operator-pending mappings for "around next parenthesis" and "around last
-parenthesis".
+Create operator-pending mappings for "around next parentheses" and "around last
+parentheses".
 
 Create similar mappings for in/around next/last for curly brackets.
 
--- a/chapters/16.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/16.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -24,7 +24,7 @@
     This is some text about topic two.  It has only one paragraph.
 
 The lines "underlined" with `=` characters are treated as heading by Markdown.
-Lets create some mappings that let us target headings with movements.  Run the
+Let's create some mappings that let us target headings with movements.  Run the
 following command:
 
     :::vim
--- a/chapters/17.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/17.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -41,7 +41,7 @@
 comments explaining each piece for other people reading the code (or ourselves
 several months later).
 
-Run the following command:
+Run the following commands:
 
     :::vim
     :set statusline=%l    " Current line
--- a/chapters/18.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/18.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -43,8 +43,8 @@
 
     :::vim
     augroup filetype_vim
-        au!
-        au FileType vim setlocal foldmethod=marker
+        autocmd!
+        autocmd FileType vim setlocal foldmethod=marker
     augroup END
 
 This will tell Vim to use the `marker` method of folding for any Vimscript
--- a/chapters/19.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/19.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -22,7 +22,7 @@
     :let foo = 42
     :echo foo
 
-Vim will display "42", because we've reassigned `bar` to the integer "42".  From
+Vim will display "42", because we've reassigned `foo` to the integer "42".  From
 this it may seem that Vimscript is dynamically typed.  That's not the case, but
 we'll talk more about that later.
 
--- a/chapters/21.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/21.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -45,8 +45,8 @@
     :    echom "ONE"
     :endif
 
-Vim will display "ONE", because the integer `1` is "truthy".  Now try this
-command:
+Vim will display "ONE", because the integer `1` is "truthy".  Now try these
+commands:
 
     :::vim
     :if 0
@@ -54,7 +54,7 @@
     :endif
 
 Vim will *not* display "ZERO" because the integer `0` is "falsy".  Let's see how
-strings behave.  Run this command:
+strings behave.  Run these commands:
 
     :::vim
     :if "something"
@@ -64,7 +64,7 @@
 The results may surprise you.  Vim does *not* necessarily treat a non-empty
 string as "truthy", so it will not display anything!
 
-Let's dive a bit further down the rabbit hole.  Run this command:
+Let's dive a bit further down the rabbit hole.  Run these commands:
 
     :::vim
     :if "9024"
@@ -73,7 +73,7 @@
 
 This time Vim *does* display the text!  What's going on here?
 
-To try to wrap our heads around what's going on, run the following two commands:
+To try to wrap our heads around what's going on, run the following three commands:
 
     :::vim
     :echom "hello" + 10
@@ -92,7 +92,7 @@
 * Strings that start with a number are coerced to that number, otherwise they're
   coerced to `0`.
 * Vim will execute the body of an `if` statement when its condition evaluates to
-  a non-zero integer, *after* all coersion takes place.
+  a non-zero integer, *after* all coercion takes place.
 
 Else and Elseif
 ---------------
@@ -115,4 +115,4 @@
 Exercises
 ---------
 
-Drink a beer to console yourself about Vim's coersion of strings to integers.
+Drink a beer to console yourself about Vim's coercion of strings to integers.
--- a/chapters/22.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/22.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -5,14 +5,14 @@
 compare things.  Of course Vim lets us compare values, but it's not as
 straightforward as it may seem.
 
-Run the following command:
+Run the following commands:
 
     :::vim
     :if 10 > 1
     :    echom "foo"
     :endif
 
-Vim will, of course, display "foo".  Now run this command:
+Vim will, of course, display "foo".  Now run these commands:
 
     :::vim
     :if 10 > 2001
@@ -20,7 +20,7 @@
     :endif
 
 Vim displays nothing, because `10` is not greater than `2001`.  So far
-everything works as expected.  Run this command:
+everything works as expected.  Run these commands:
 
     :::vim
     :if 10 == 11
@@ -30,7 +30,7 @@
     :endif
 
 Vim displays "second".  Nothing surprising here.  Let's try comparing strings.
-Run this command:
+Run these commands:
 
     :::vim
     :if "foo" == "bar"
@@ -66,7 +66,7 @@
     :    echom "this must be the one"
     :endif
 
-**Woah**.  Stop right there.  Yes, you saw that right.
+**Whoa**.  Stop right there.  Yes, you saw that right.
 
 **The behavior of `==` depends on a user's settings.**
 
@@ -87,10 +87,10 @@
 So how can you get around this ridiculousness?  It turns out that Vim has *two
 extra sets* of comparison operators to deal with this.
 
-Run the following command:
+Run the following commands:
 
     :::vim
-    :set ignorecase
+    :set noignorecase
     :if "foo" ==? "FOO"
     :    echom "first"
     :elseif "foo" ==? "foo"
@@ -98,7 +98,7 @@
     :endif
 
 Vim displays "first" because `==?` is the "case-insensitive no matter what the
-user has set" comparison operator.  Now run the following command:
+user has set" comparison operator.  Now run the following commands:
 
     :::vim
     :set ignorecase
--- a/chapters/23.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/23.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -4,7 +4,7 @@
 Like most programming languages, Vimscript has functions.  Let's take a look at
 how to create them, and then talk about some of their quirks.
 
-Run the following commands:
+Run the following command:
 
     :::vim
     :function meow()
--- a/chapters/25.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/25.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -10,7 +10,7 @@
 Number Formats
 --------------
 
-You can specify Numbers in a few different ways.  Run the following command.
+You can specify Numbers in a few different ways.  Run the following command:
 
     :::vim
     :echom 100
@@ -62,8 +62,8 @@
     :::vim
     :echo 15.45e-2
 
-Vim displays "0.1545".  The `+` or `-` before the power of ten is optional, if
-it's omitted the it's assumed to be positive.  Run the following command:
+Vim displays "0.1545".  The `+` or `-` before the power of ten is optional. If
+it's omitted then it's assumed to be positive.  Run the following command:
 
     :::vim
     :echo 15.3e9
@@ -94,7 +94,7 @@
     :::vim
     :echo 3 / 2
 
-Vim displays "1".  If you want Vim to perform float point division one of the
+Vim displays "1".  If you want Vim to perform floating point division one of the
 numbers needs to be a Float, which will cause the other one to be coerced to
 a Float as well.  Run this command:
 
--- a/chapters/26.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/26.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -120,7 +120,7 @@
     :echom '\n\\'
 
 Vim displays `\n\\`.  Using single quotes tells Vim that you want the string
-*exactly* as-in, with no escape sequences.  The one exception is that two single
+*exactly* as-is, with no escape sequences.  The one exception is that two single
 quotes in a row will produce a single single quote.  Try this command:
 
     :::vim
--- a/chapters/28.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/28.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -12,7 +12,7 @@
 build commands out of arbitrary strings.
 
 Let's try a more useful example.  Prepare by opening a file in Vim, then using
-`:edit "foo.txt"` in the same window to open a new buffer.  Now run the
+`:edit foo.txt` in the same window to open a new buffer.  Now run the
 following command:
 
     :::vim
@@ -21,7 +21,7 @@
 Vim will open the first file in a vertical split to the right of the second
 file.  What happened here?
 
-First, Vim sees builds the command string by concatenating "rightbelow vsplit
+First, Vim builds the command string by concatenating "rightbelow vsplit
 " with the result of the `bufname("#")` call.
 
 We'll look at the function more later, but for now just trust that it returns
--- a/chapters/30.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/30.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -14,7 +14,7 @@
 the return needed to actually perform the search.  Combining `normal!` with
 `execute` fixes that problem.
 
-`execute` lets you build commands programatically, so you can use Vim's normal
+`execute` lets you build commands programmatically, so you can use Vim's normal
 string escape sequences to generate the non-printing characters you need.  Try
 the following command:
 
--- a/chapters/32.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/32.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -2,7 +2,7 @@
 ===================================
 
 In this chapter and the next we're going to walk through creating
-a fairly-complicated piece of Vimscript.  We'll talk about several things we
+a fairly complicated piece of Vimscript.  We'll talk about several things we
 haven't seen before, as well as how some of the things we've studied fit
 together in practice.
 
@@ -69,12 +69,12 @@
 command:
 
     :::vim
-    :nnoremap <leader> g :grep -R something .<cr>
+    :nnoremap <leader>g :grep -R something .<cr>
 
 If you've read `:help grep` this should be pretty easy to understand.  We've
 looked at lots of mappings before, and there's nothing new here.
 
-Obviously we're not done yet, so lets refine this mapping until it meets our
+Obviously we're not done yet, so let's refine this mapping until it meets our
 simplified goal.
 
 The Search Term
@@ -113,9 +113,14 @@
     :nnoremap <leader>g :grep -R '<cWORD>' .<cr>
 
 Most shells treat single-quoted text as (almost) literal, so our mapping is much
-more robust now.  However there's still one more problem with the search term!
-Try the mapping on the word "that's".  It won't work, because the single quote
-inside the word interferes with the quotes in the grep command!
+more robust now.
+
+Escaping Shell Command Arguments
+--------------------------------
+
+However there's still one more problem with the search term.  Try the mapping on
+the word "that's".  It won't work, because the single quote inside the word
+interferes with the quotes in the grep command!
 
 To get around this we can use Vim's `shellescape` function.  Read `:help
 escape()` and `:help shellescape()` to see how it works (it's pretty simple).
@@ -133,7 +138,51 @@
     :::vim
     :nnoremap <leader>g :execute "grep -R " . shellescape("<cWORD>") . " ."<cr>
 
-And now our mapping won't break if the word we're searching for happens to
+Try it out by running it on a normal word like "foo".  It will work properly.
+Now try it out on a word with a quote in it, like "that's".  It will not work!
+What happened?
+
+The problem is that Vim performed the `shellescape()` call *before* it expanded
+out special strings like `<cWORD>` in the command line.  So Vim shell-escaped
+the literal string `"<cWORD>"` (which did nothing but add single quotes to it)
+and then concatenated it with the strings of our `grep` command.
+
+You can see this by running the following command:
+
+    :::vim
+    :echom shellescape("<cWORD>")
+
+Vim will output `'<cWORD>'`.  Note that those quotes are actually part of the
+string -- Vim has prepared it for use as a shell command argument.
+
+To fix this we'll use the `expand()` function to force the expansion of
+`<cWORD>` into the actual string *before* it gets passed to `shellescape`.
+
+Let's break this apart and see how it works, in steps.  Put your cursor over
+a word with q quote, like "that's", and run the following command:
+
+    :::vim
+    :echom expand("<cWORD>")
+
+Vim outputs `that's` because `expand("<cWORD>")` will return the current word
+under the cursor as a Vim string.  Now let's add `shellescape` back in:
+
+    :::vim
+    :echom shellescape(expand("<cWORD>"))
+
+This time Vim outputs `'that'\''s'`.  If this looks a little funny, you haven't
+had the pleasure of wrapping your brain around shell-quoting in all its insane
+glory.  For now, don't worry about it.  Just trust the Vim has taken the string
+from `expand` and escaped it properly.
+
+Now that we know how to get a fully-escaped version of the word under the
+cursor, it's time to concatenate it into our mapping!  Run the following
+command:
+
+    :::vim
+    :nnoremap <leader>g :execute "grep -R " . shellescape(expand("<cWORD>")) . " ."<cr>
+
+Try it out.  Our mapping won't break if the word we're searching for happens to
 contain strange characters.
 
 The process of starting with a trivial bit of Vimscript and transforming it
@@ -149,14 +198,14 @@
 this command:
 
     :::vim
-    :nnoremap <leader>g :execute "grep! -R " . shellescape("<cWORD>") . " ."<cr>
+    :nnoremap <leader>g :execute "grep! -R " . shellescape(expand("<cWORD>")) . " ."<cr>
 
 Try it out again and nothing will seem to happen.  Vim has filled the quickfix
 window with the results, but we haven't opened it yet.  Run the following
 command:
 
     :::vim
-    :nnoremap <leader>g :execute "grep! -R " . shellescape("<cWORD>") . " ."<cr>:copen<cr>
+    :nnoremap <leader>g :execute "grep! -R " . shellescape(expand("<cWORD>")) . " ."<cr>:copen<cr>
 
 Now try the mapping and you'll see that Vim automatically opens the quickfix
 window with the search results.  All we did was tack `:copen<cr>` onto the end
@@ -166,7 +215,7 @@
 searching.  Run the following command:
 
     :::vim
-    :nnoremap <leader>g :silent execute "grep! -R " . shellescape("<cWORD>") . " ."<cr>:copen<cr>
+    :nnoremap <leader>g :silent execute "grep! -R " . shellescape(expand("<cWORD>")) . " ."<cr>:copen<cr>
 
 We're done, so try it out and admire your hard work!  The `silent` command just
 runs the command that follows it while hiding any messages it would normally
@@ -177,7 +226,7 @@
 
 Add the mapping we just created to your `~/.vimrc` file.
 
-Read `:help :grep`.
+Read `:help :grep` if you didn't read it before.
 
 Read `:help cnext` and `:help cprevious`.  Try them out after using your new
 grep mapping.
@@ -185,6 +234,8 @@
 Set up mappings for `:cnext` and `:cprevious` to make it easier to quickly run
 through matches.
 
+Read `:help expand`.
+
 Read `:help copen`.
 
 Add a height to the `:copen` command in the mapping we created to make sure the
--- a/chapters/33.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/33.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -22,8 +22,9 @@
 enough to warrant a file of its own.
 
 First, find your Vim `plugin` directory.  On Linux or OS X this will be at
-`~/.vim/plugin`.  If you're on Windows it will be at TODO.  If this directory
-doesn't exist, create it.
+`~/.vim/plugin`.  If you're on Windows it will be inside the `vimfiles`
+directory in your home directory. (Use the command: `:echo $HOME` in Vim if
+you're not sure where this is). If this directory doesn't exist, create it.
 
 Inside `plugin/` create a file named `grep-operator.vim`.  This is where you'll
 place the code for this new operator.  When you're editing the file you can run
--- a/chapters/35.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/35.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -133,9 +133,9 @@
     :echo join(foo, '---')
     :echo join([1, 2, 3], '')
 
-Vim displays "a b" and "a---b".  `join` will join the items in the given list
-together into a string, separated by the given separator string (or a space if
-none is given), coercing each item to a string if necessary/possible.
+Vim displays "a b", "a---b", and "123".  `join` will join the items in the given
+list together into a string, separated by the given separator string (or a space
+if none is given), coercing each item to a string if necessary/possible.
 
 Run the following commands:
 
--- a/chapters/38.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/38.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -3,7 +3,7 @@
 
 In one of the first chapters we talked about how to set options in Vim.  For
 boolean options we can use `set someoption!` to "toggle" the option.  This is
-expecially nice when we create a mapping for that command.
+especially nice when we create a mapping for that command.
 
 Run the following command:
 
--- a/chapters/45.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/45.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -59,7 +59,7 @@
 don't need to know about individual languages.
 
 Potion has a bunch of other keywords that we haven't used in our toy program, so
-lets edit our syntax file to highlight those too:
+let's edit our syntax file to highlight those too:
 
     :::vim
     syntax keyword potionKeyword loop times to while
--- a/chapters/49.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/49.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -78,17 +78,17 @@
 Now run the following command to view the foldlevel of line 1:
 
     :::vim
-    :echom foldmethod(1)
+    :echom foldlevel(1)
 
 Vim will display `0`.  Now let's find the foldlevel of line 2:
 
     :::vim
-    :echom foldmethod(2)
+    :echom foldlevel(2)
 
 Vim will display `1`.  Let's try line 3:
 
     :::vim
-    :echom foldmethod(3)
+    :echom foldlevel(3)
 
 Once again Vim displays `1`.  This means that lines 2 and 3 are part of a level
 1 fold.
@@ -330,7 +330,7 @@
 a given line.  Add the following function above `IndentLevel`:
 
     :::vim
-    function! s:NextNonBlankLine(lnum)
+    function! NextNonBlankLine(lnum)
         let numlines = line('$')
         let current = a:lnum + 1
 
--- a/chapters/51.markdown	Tue Apr 24 14:30:05 2012 +0100
+++ b/chapters/51.markdown	Sat Sep 08 13:45:05 2012 -0400
@@ -353,7 +353,7 @@
 * Using a single function with several arguments to simplify creating related
   mappings.
 * Building up functionality in a Vimscript function incrementally.
-* Building up an `execute 'normal! ...'` string programatically.
+* Building up an `execute 'normal! ...'` string programmatically.
 * Using simple searches to move around with regexes.
 * Using special regex atoms like `%^` (beginning of file).
 * Using search flags to modify how searches work.
--- a/publish.sh	Tue Apr 24 14:30:05 2012 +0100
+++ b/publish.sh	Sat Sep 08 13:45:05 2012 -0400
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
 
 set -e
-../../bookmarkdown/bookmarkdown/bookmarkdown build
+./venv/bin/python ../bookmarkdown/bookmarkdown/bookmarkdown build
 rsync --delete -az build/html/ sl:/var/www/vimscript/