78f061a9fff8

Proof 0-2
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 10 Nov 2012 14:21:55 -0500
parents dc6a6332b281
children 41e61b3dce7a
branches/tags (none)
files chapters/00.markdown chapters/01.markdown chapters/02.markdown

Changes

--- a/chapters/00.markdown	Sat Nov 10 13:45:43 2012 -0500
+++ b/chapters/00.markdown	Sat Nov 10 14:21:55 2012 -0500
@@ -3,30 +3,33 @@
 
 To use this book you should have the latest version of Vim installed, which is
 version 7.3 at the time of this writing.  New versions of Vim are almost always
-backwards-compatible, so everything in this book should work just fine with
-anything after 7.3 too.
+backwards-compatible, so everything in this book should work fine with anything
+after 7.3 too.
 
-You should be comfortable editing files in Vim.
-
-You should know basic Vim terminology like "buffer", "window", "normal mode",
-"insert mode" and "text object".
+Nothing in this book is specific to console Vim or GUI Vims like gVim or MacVim.
+You can use whichever you prefer.
 
-If you're not at that point yet go through the `vimtutor` program, use Vim
-exclusively for a month or two, and come back when you've got Vim burned into
-your fingers.
+You should be comfortable editing files in Vim.  You should know basic Vim
+terminology like "buffer", "window", "normal mode", "insert mode" and "text
+object".
 
-You should have some programming experience.  If you've never programmed before
-check out [Learn Python the Hard Way](http://learnpythonthehardway.org/) first
-and come back to this book when you're done.
+If you're not at that point yet you should go through the `vimtutor` program,
+use Vim exclusively for a month or two, and come back when you've got Vim burned
+into your fingers.
+
+You'll also need to have some programming experience.  If you've never
+programmed before check out [Learn Python the Hard
+Way](http://learnpythonthehardway.org/) first and come back to this book when
+you're done.
 
 Creating a Vimrc File
 ---------------------
 
-If you already know what a vimrc file is and have one, go on to the next
+If you already know what a `~/.vimrc` file is and have one, go on to the next
 chapter.
 
-A vimrc file is a file you create that contains some Vimscript code.  Vim will
-automatically run the code inside this file every time you open Vim.
+A `~/.vimrc` file is a file you create that contains some Vimscript code.  Vim
+will automatically run the code inside this file every time you open Vim.
 
 On Linux and Mac OS X this file is located in your home directory and named
 `.vimrc`.
--- a/chapters/01.markdown	Sat Nov 10 13:45:43 2012 -0500
+++ b/chapters/01.markdown	Sat Nov 10 14:21:55 2012 -0500
@@ -1,48 +1,48 @@
 Echoing Messages
 ================
 
-The first piece of Vimscript we'll look at is `echom`.
+The first pieces of Vimscript we'll look at are the `echo` and `echom` commands.
 
-You can read the full documentation for the command by running `:help echom` in
-Vim.  As you go through this book you should try to read the `:help` for every
-new command you encounter to get a better understanding of how to use each one.
+You can read their full documentation by running `:help echo` and `:help echom`
+in Vim.  As you go through this book you should try to read the `:help` for
+every new command you encounter to learn more about them.
 
-Run the following command:
+Try out `echo` by running the following command:
 
     :::vim
     :echo "Hello, world!"
 
-You should see `Hello, world!` appear at the bottom of the window.
+You should see "Hello, world!" appear at the bottom of the window.
 
 Persistent Echoing
 ------------------
 
-Now run the following command:
+Now try out `echom` by running the following command.
 
     :::vim
     :echom "Hello again, world!"
 
-You should see `Hello again, world!` appear at the bottom of the window.
+You should see "Hello again, world!" appear at the bottom of the window.
 
-To see the difference between these two commands, run one more new command:
+To see the difference between these two commands, run the following:
 
     :::vim
     :messages
 
-You should see a list of messages.  `Hello, world!` will *not* be in this list,
-but `Hello again, world!` *will* be in it.
+You should see a list of messages.  "Hello, world!" will *not* be in this list,
+but "Hello again, world!" *will* be in it.
 
-When you're writing more complicated Vim scripts later in this book you may find
+When you're writing more complicated Vimscript later in this book you may find
 yourself wanting to "print some output" to help you debug problems.  Plain old
-`:echo`will print output, but it will often disappear by the time your script is
-done.  Using `:echom` will save the output and let you run `:messages` to view
-it later.
+`:echo` will print output, but it will often disappear by the time your script
+is done.  Using `:echom` will save the output and let you run `:messages` to
+view it later.
 
 Comments
 --------
 
-Before we move on we should mention comments.  When you write Vimscript code (in
-your `~/.vimrc` file or another one) you can add comments with the `"`
+Before moving, let's look at how to add comments.  When you write Vimscript code
+(in your `~/.vimrc` file or any other one) you can add comments with the `"`
 character, like this:
 
     :::vim
@@ -50,7 +50,7 @@
     nnoremap <space> za
 
 This doesn't *always* work (that's one of those ugly corners of Vimscript), but
-in most cases it does, and we'll talk about when it won't (and why that
+in most cases it does.  Later we'll talk about when it won't (and why that
 happens).
 
 Exercises
@@ -62,5 +62,5 @@
 
 Read `:help messages`.
 
-Add a line to your vimrc file that displays a friendly ASCII-art cat (`>^.^<`)
-whenever you open Vim.
+Add a line to your `~/.vimrc` file that displays a friendly ASCII-art cat
+(`>^.^<`) whenever you open Vim.
--- a/chapters/02.markdown	Sat Nov 10 13:45:43 2012 -0500
+++ b/chapters/02.markdown	Sat Nov 10 14:21:55 2012 -0500
@@ -6,22 +6,29 @@
 There are two main kinds of options: boolean options (either "on" or "off") and
 options that take a value.
 
+Boolean Options
+---------------
+
 Run the following command:
 
     :::vim
     :set number
 
-Line numbers should appear in Vim.  Now run this:
+Line numbers should appear on the left side of the window if they weren't there
+already.  Now run this:
 
     :::vim
     :set nonumber
 
-The line numbers should disappear.  `number` is a boolean option -- it can be
-off or on.  You turn it "on" by running `:set number` and "off" with `:set
+The line numbers should disappear.  `number` is a boolean option: it can be off
+or on.  You turn it "on" by running `:set number` and "off" with `:set
 nonumber`.
 
-Toggling Options
-----------------
+All boolean options work this way.  `:set <name>` turns the option on and `:set
+no<name>` turns it off.
+
+Toggling Boolean Options
+------------------------
 
 You can also "toggle" boolean options to set them to the *opposite* of whatever
 they are now.  Run this:
@@ -49,8 +56,8 @@
     :set nonumber
     :set number?
 
-Notice how the first `:set number?` command displayed `number` while the second
-displayed `nonumber`.
+Notice how the first `:set number?` command displayed "number" while the second
+displayed "nonumber".
 
 Options with Values
 -------------------
@@ -65,7 +72,8 @@
     :set numberwidth?
 
 The `numberwidth` option changes how wide the column containing line numbers
-will be.
+will be.  You can change non-boolean options with `:set <name>=<value>`, and
+check them the usual way (`:set <name>?`).
 
 Try checking what a few other common options are set to:
 
@@ -77,16 +85,20 @@
 Setting Multiple Options at Once
 --------------------------------
 
-Finally, you can specify more than one option in the same `:set` command.  Try
-running this:
+Finally, you can specify more than one option in the same `:set` command to save
+on some typing.  Try running this:
 
     :::vim
+    :set numberwidth=2
+    :set nonumber
     :set number numberwidth=6
 
+Notice how both options were set and took effect in the last command.
+
 Exercises
 ---------
 
-Read `:help 'number'` (note the quotes).
+Read `:help 'number'` (notice the quotes).
 
 Read `:help relativenumber`.
 
@@ -98,4 +110,4 @@
 
 Read `:help matchtime`.
 
-Add a few lines to your vimrc file to set these options however you like.
+Add a few lines to your `~/.vimrc` file to set these options however you like.