# HG changeset patch # User Steve Losh # Date 1338671898 14400 # Node ID fd07be518d4639afab9212143f64310a783d654f # Parent 90badcd0796927270c2d6f32609ff8e895fdbe97# Parent d7ce6dbc63d385f9ed2f762f9dcd054258a82b34 Merge. diff -r 90badcd07969 -r fd07be518d46 acknowledgements.markdown --- a/acknowledgements.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/acknowledgements.markdown Sat Jun 02 17:18:18 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) diff -r 90badcd07969 -r fd07be518d46 chapters/07.markdown --- a/chapters/07.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/07.markdown Sat Jun 02 17:18:18 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 diff -r 90badcd07969 -r fd07be518d46 chapters/09.markdown --- a/chapters/09.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/09.markdown Sat Jun 02 17:18:18 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 diff -r 90badcd07969 -r fd07be518d46 chapters/11.markdown --- a/chapters/11.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/11.markdown Sat Jun 02 17:18:18 2012 -0400 @@ -97,7 +97,7 @@ :nnoremap Q x :nnoremap Q dd -Now switch to file `foo` and type `Q`. What happens? +Staying in file `foo`, 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. diff -r 90badcd07969 -r fd07be518d46 chapters/13.markdown --- a/chapters/13.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/13.markdown Sat Jun 02 17:18:18 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 `“` and `”` +languages, `function` for javascript, and things like `“` and `”` for HTML files. Add these snippets to your `~/.vimrc` file. diff -r 90badcd07969 -r fd07be518d46 chapters/14.markdown --- a/chapters/14.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/14.markdown Sat Jun 02 17:18:18 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 diff -r 90badcd07969 -r fd07be518d46 chapters/15.markdown --- a/chapters/15.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/15.markdown Sat Jun 02 17:18:18 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. diff -r 90badcd07969 -r fd07be518d46 chapters/16.markdown --- a/chapters/16.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/16.markdown Sat Jun 02 17:18:18 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 diff -r 90badcd07969 -r fd07be518d46 chapters/17.markdown --- a/chapters/17.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/17.markdown Sat Jun 02 17:18:18 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 diff -r 90badcd07969 -r fd07be518d46 chapters/19.markdown --- a/chapters/19.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/19.markdown Sat Jun 02 17:18:18 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. diff -r 90badcd07969 -r fd07be518d46 chapters/21.markdown --- a/chapters/21.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/21.markdown Sat Jun 02 17:18:18 2012 -0400 @@ -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. diff -r 90badcd07969 -r fd07be518d46 chapters/22.markdown --- a/chapters/22.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/22.markdown Sat Jun 02 17:18:18 2012 -0400 @@ -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.** diff -r 90badcd07969 -r fd07be518d46 chapters/25.markdown --- a/chapters/25.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/25.markdown Sat Jun 02 17:18:18 2012 -0400 @@ -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: diff -r 90badcd07969 -r fd07be518d46 chapters/26.markdown --- a/chapters/26.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/26.markdown Sat Jun 02 17:18:18 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 diff -r 90badcd07969 -r fd07be518d46 chapters/28.markdown --- a/chapters/28.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/28.markdown Sat Jun 02 17:18:18 2012 -0400 @@ -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 diff -r 90badcd07969 -r fd07be518d46 chapters/30.markdown --- a/chapters/30.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/30.markdown Sat Jun 02 17:18:18 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: diff -r 90badcd07969 -r fd07be518d46 chapters/32.markdown --- a/chapters/32.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/32.markdown Sat Jun 02 17:18:18 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 g :grep -R something . + :nnoremap g :grep -R something . 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 diff -r 90badcd07969 -r fd07be518d46 chapters/35.markdown --- a/chapters/35.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/35.markdown Sat Jun 02 17:18:18 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: diff -r 90badcd07969 -r fd07be518d46 chapters/38.markdown --- a/chapters/38.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/38.markdown Sat Jun 02 17:18:18 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: diff -r 90badcd07969 -r fd07be518d46 chapters/45.markdown --- a/chapters/45.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/45.markdown Sat Jun 02 17:18:18 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 diff -r 90badcd07969 -r fd07be518d46 chapters/51.markdown --- a/chapters/51.markdown Sat Jun 02 17:09:36 2012 -0400 +++ b/chapters/51.markdown Sat Jun 02 17:18:18 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.