# HG changeset patch # User Steve Losh # Date 1339877429 14400 # Node ID ee45fef4cd6ba26f219471b197f1280dc4d2a16d # Parent 3e314e533b1d5f2c753b3011fba026d05f67643b# Parent 965a6874086b1dccf764772ec9c169919bd4e89a Merge. diff -r 3e314e533b1d -r ee45fef4cd6b chapters/05.markdown --- a/chapters/05.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/05.markdown Sat Jun 16 16:10:29 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. diff -r 3e314e533b1d -r ee45fef4cd6b chapters/08.markdown --- a/chapters/08.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/08.markdown Sat Jun 16 16:10:29 2012 -0400 @@ -89,7 +89,7 @@ Run this command: :::vim - :inoremap ssig --Steve Loshsteve@stevelosh.com + :inoremap ssig -- Steve Loshsteve@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 --Steve Loshsteve@stevelosh.com + :iabbrev ssig -- Steve Loshsteve@stevelosh.com Now try out the abbreviation again. diff -r 3e314e533b1d -r ee45fef4cd6b chapters/09.markdown --- a/chapters/09.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/09.markdown Sat Jun 16 16:10:29 2012 -0400 @@ -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`. diff -r 3e314e533b1d -r ee45fef4cd6b chapters/11.markdown --- a/chapters/11.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/11.markdown Sat Jun 16 16:10:29 2012 -0400 @@ -97,7 +97,7 @@ :nnoremap Q x :nnoremap Q dd -Staying in file `foo`, 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. diff -r 3e314e533b1d -r ee45fef4cd6b chapters/18.markdown --- a/chapters/18.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/18.markdown Sat Jun 16 16:10:29 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 diff -r 3e314e533b1d -r ee45fef4cd6b chapters/21.markdown --- a/chapters/21.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/21.markdown Sat Jun 16 16:10:29 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" diff -r 3e314e533b1d -r ee45fef4cd6b chapters/22.markdown --- a/chapters/22.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/22.markdown Sat Jun 16 16:10:29 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" @@ -87,7 +87,7 @@ 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 noignorecase @@ -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 diff -r 3e314e533b1d -r ee45fef4cd6b chapters/23.markdown --- a/chapters/23.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/23.markdown Sat Jun 16 16:10:29 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() diff -r 3e314e533b1d -r ee45fef4cd6b chapters/25.markdown --- a/chapters/25.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/25.markdown Sat Jun 16 16:10:29 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 diff -r 3e314e533b1d -r ee45fef4cd6b chapters/28.markdown --- a/chapters/28.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/28.markdown Sat Jun 16 16:10:29 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 diff -r 3e314e533b1d -r ee45fef4cd6b chapters/32.markdown diff -r 3e314e533b1d -r ee45fef4cd6b chapters/33.markdown --- a/chapters/33.markdown Sat Jun 16 16:05:20 2012 -0400 +++ b/chapters/33.markdown Sat Jun 16 16:10:29 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