Commits

Steve Losh  committed 436f8ce

Proof 09-12.

  • Participants
  • Parent commits b0ca11b

Comments (0)

Files changed (5)

File chapters/09.markdown

 
 I know we've talked a lot about mappings so far, but we're going to practice
 them again now.  Mappings are one of the easiest and fastest ways to make your
-Vim editing more productive, so it's good to focus on them quite a bit.
+Vim editing more productive so it's good to focus on them quite a bit.
 
 One concept that has showed up in several examples but that we haven't
 explicitly talked about is mapping a sequence of multiple keys.
 
 Add all of these mappings to your `~/.vimrc` file, making sure to use your "edit
 my `~/.vimrc`" and "source my `~/.vimrc`" mappings to do so.
+

File chapters/10.markdown

     :inoremap <esc> <nop>
 
 This effectively disables the escape key in insert mode by telling Vim to
-perform `<nop>` (no operation) instead.
+perform `<nop>` (no operation) instead.  Now you *have* to use your `jk` mapping
+to exit insert mode.
 
-Now you *have* to use your `jk` mapping to exit insert mode.  At first you'll
-forget, type escape and start trying to do something in normal mode and you'll
-wind up with stray characters in your text.  It will be frustrating, but if you
-stick with it you'll be surprised at how fast your mind and fingers absorb the
-new mapping.  Within an hour or two you won't be accidentally hitting escape any
-more.
+At first you'll forget, type escape and start trying to do something in normal
+mode and you'll wind up with stray characters in your text.  It will be
+frustrating, but if you stick with it you'll be surprised at how fast your mind
+and fingers absorb the new mapping.  Within an hour or two you won't be
+accidentally hitting escape any more.
 
 This idea applies to any new mapping you create to replace an old one, and even
 to life in general.  When you want to change a habit, make it harder or
 If you still use the arrow keys in insert mode, map them to `<nop>` there too.
 The right way to use Vim is to get out of insert mode as soon as you can and use
 normal mode to move around.
+

File chapters/11.markdown

 =================================
 
 Now we're going to take a few minutes to revisit three things we've already
-talked about: mappings, abbreviations, and options, but with a twist: we're
+talked about: mappings, abbreviations, and options, but with a twist.  We're
 going to set each of them in a single buffer at a time.
 
 The true power of this idea will become apparent in the next chapter, but we
     :nnoremap <buffer> <leader>x dd
 
 Now stay in file `foo`, make sure you're in normal mode, and type `<leader>d`.
-Vim will delete a line.  This is nothing new to us.
+Vim will delete a line.  This is nothing new.
 
 Still in file `foo`, type `<leader>x`.  Vim will delete a line again.  This
 makes sense because we mapped `<leader>x` to `dd` as well.
 Now move over to file `bar`.  While in normal mode, type `<leader>d`.  Again,
 Vim deletes the current line.  Nothing surprising here either.
 
-Now for the twist: while still in file `bar` type `<leader>x`.
+Now for the twist: while still in file `bar`, type `<leader>x`.
 
 Instead of deleting the entire line, Vim just deleted a single character!
 What happened?

File chapters/12.markdown

 
 This is almost like our last command, except it will also reindent the code
 whenever we *read* an HTML file as well as when we write it.  This could be
-useful if you have coworkers that don't indent their HTML well.
+useful if you have coworkers that don't indent their HTML nicely.
 
 A common idiom in Vim scripting is to pair the `BufRead` and `BufNewFile` events
 together to run a command whenever you open a certain kind of file, regardless
 following commands:
 
     :::vim
-    :autocmd FileType javascript nnoremap <buffer> <localleader>c I//
-    :autocmd FileType python     nnoremap <buffer> <localleader>c I#
+    :autocmd FileType javascript nnoremap <buffer> <localleader>c I//<esc>
+    :autocmd FileType python     nnoremap <buffer> <localleader>c I#<esc>
 
 Open a Javascript file (a file that ends in `.js`), pick a line and type
 `<localleader>c`.  This will comment out the line.
 think about moving to the beginning of the line and adding a comment character
 we can simply think "comment this line".
 
-You may have noticed that this mapping leaves us in insert mode.  Unfortunately
-we can't fix that just yet, but we'll get to it later in the book!
-
 Exercises
 ---------
 
 Skim `:help autocmd-events` to see a list of all the events you can bind
-autocommands to.  You don't need to memorize each one right now; just try to get
-a feel for the kinds of things you can do.
+autocommands to.  You don't need to memorize each one right now.  Just try to
+get a feel for the kinds of things you can do.
 
 Create a few `FileType` autocommands that use `setlocal` to set options for your
 favorite filetypes just the way you like them.  Some options you might like to
 
     If you type `:echom "Hello!"` Vim will output `Hello`.
 
+Filenames should also be in backticks.
+
 Key mappings should be lowercase.
 
     nnoremap <esc> ...