--- a/chapters/32.markdown Wed Apr 03 21:57:57 2013 -0400
+++ b/chapters/32.markdown Wed Apr 03 22:05:04 2013 -0400
@@ -95,8 +95,8 @@
:::vim
:nnoremap <leader>g :grep -R <cWORD> .<cr>
-Now try the mapping when your cursor is over something like "foo-bar". Vim will
-grep for "foo-bar" instead of just part of the word.
+Now try the mapping when your cursor is over something like `foo-bar`. Vim will
+grep for `foo-bar` instead of just part of the word.
There's still a problem with our search term: if there are any special shell
characters in it Vim will happily pass them along to the external grep command,
@@ -119,7 +119,7 @@
--------------------------------
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
+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
@@ -138,8 +138,8 @@
:::vim
:nnoremap <leader>g :execute "grep -R " . shellescape("<cWORD>") . " ."<cr>
-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 still doesn't
+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 still doesn't
work! What happened?
The problem is that Vim performed the `shellescape()` call *before* it expanded
@@ -159,7 +159,7 @@
`<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 a quote, like "that's", and run the following command:
+a word with a quote, like `that's`, and run the following command:
:::vim
:echom expand("<cWORD>")
--- a/chapters/33.markdown Wed Apr 03 21:57:57 2013 -0400
+++ b/chapters/33.markdown Wed Apr 03 22:05:04 2013 -0400
@@ -48,7 +48,7 @@
endfunction
Write the file and source it with `:source %`. Try it out by pressing
-`<leader>giw` to say "grep inside word". Vim will echo "Test" *after* accepting
+`<leader>giw` to say "grep inside word". Vim will echo `Test` *after* accepting
the `iw` motion, which means we've laid out the skeleton.
The function is simple and nothing we haven't seen before, but that mapping is
@@ -69,7 +69,7 @@
vnoremap <leader>g :<c-u>call GrepOperator(visualmode())<cr>
Write and source the file. Now visually select something and press `<leader>g`.
-Nothing happens, but Vim does echo "Test", so our function is getting called.
+Nothing happens, but Vim does echo `Test`, so our function is getting called.
We've seen the `<c-u>` in this mapping before but never explained what it did.
Try visually selecting some text and pressing `:`. Vim will open a command line
@@ -86,7 +86,7 @@
the `visualmode()` we're passing as an argument is new. This function is
a built-in Vim function that returns a one-character string representing the
last type of visual mode used: `"v"` for characterwise, `"V"` for
-linewise, and a `ctrl-v` character for blockwise.
+linewise, and a `Ctrl-v` character for blockwise.
Motion Types
------------
--- a/chapters/35.markdown Wed Apr 03 21:57:57 2013 -0400
+++ b/chapters/35.markdown Wed Apr 03 22:05:04 2013 -0400
@@ -28,7 +28,7 @@
:::vim
:echo [0, [1, 2]][1]
-Vim displays "[1, 2]". You can also index from the end of the list, much like
+Vim displays `[1, 2]`. You can also index from the end of the list, much like
Python. Try this command:
:::vim
@@ -46,7 +46,7 @@
:::vim
:echo ['a', 'b', 'c', 'd', 'e'][0:2]
-Vim displays "['a', 'b', 'c']" (elements 0, 1 and 2). You can safely exceed the
+Vim displays `['a', 'b', 'c']` (elements 0, 1 and 2). You can safely exceed the
upper bound as well. Try this command:
:::vim
@@ -59,7 +59,7 @@
:::vim
:echo ['a', 'b', 'c', 'd', 'e'][-2:-1]
-Vim displays "['d', 'e']" (elements -2 and -1).
+Vim displays `['d', 'e']` (elements -2 and -1).
When slicing lists you can leave off the first index to mean "the beginning"
and/or the last index to mean "the end". Run the following commands:
@@ -68,7 +68,7 @@
:echo ['a', 'b', 'c', 'd', 'e'][:1]
:echo ['a', 'b', 'c', 'd', 'e'][3:]
-Vim displays "['a', 'b']" and "['d', 'e']".
+Vim displays `['a', 'b']` and `['d', 'e']`.
Like Python, Vimscript allows you to index and slice strings too. Run the
following command:
@@ -76,14 +76,14 @@
:::vim
:echo "abcd"[0:2]
-Vim displays "abc". However, you can't use negative bare indices with strings.
+Vim displays `abc`. However, you can't use negative bare indices with strings.
You *can* use negative indices when slicing strings though! Run the following
command:
:::vim
:echo "abcd"[-1] . "abcd"[-2:]
-Vim displays "cd" (using a negative index silently resulted in an empty string).
+Vim displays `cd` (using a negative index silently resulted in an empty string).
Concatenation
-------------
@@ -93,7 +93,7 @@
:::vim
:echo ['a', 'b'] + ['c']
-Vim, unsurprisingly, displays "['a', 'b', 'c']". There's not much else to say
+Vim, unsurprisingly, displays `['a', 'b', 'c']`. There's not much else to say
here -- Vimscript lists are surprisingly sane compared to the rest of the
language.
@@ -108,19 +108,19 @@
:call add(foo, 'b')
:echo foo
-Vim mutates the list `foo` in-place to append `'b'` and displays "['a', 'b']".
+Vim mutates the list `foo` in-place to append `'b'` and displays `['a', 'b']`.
Now run this command:
:::vim
:echo len(foo)
-Vim displays "2", the length of the list. Try these commands:
+Vim displays `2`, the length of the list. Try these commands:
:::vim
:echo get(foo, 0, 'default')
:echo get(foo, 100, 'default')
-Vim displays "a" and "default". The `get` function will get the item at the
+Vim displays `a` and `default`. The `get` function will get the item at the
given index from the given list, or return the given default value if the index
is out of range in the list.
@@ -130,7 +130,7 @@
:echo index(foo, 'b')
:echo index(foo, 'nope')
-Vim displays "1" and "-1". The `index` function returns the first index of the
+Vim displays `1` and `-1`. The `index` function returns the first index of the
given item in the given list, or `-1` if the item is not in the list.
Now run this command:
@@ -140,7 +140,7 @@
:echo join(foo, '---')
:echo join([1, 2, 3], '')
-Vim displays "a b", "a---b", and "123". `join` will join the items in the given
+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.
@@ -152,13 +152,13 @@
:call reverse(foo)
:echo foo
-Vim displays "['b', 'a']" and then "['a', 'b']". `reverse` reverses the given
+Vim displays `['b', 'a']` and then `['a', 'b']`. `reverse` reverses the given
list *in place*.
Exercises
---------
-Read `:help List`. All of it. Notice the capital "L".
+Read `:help List`. All of it. Notice the capital `L`.
Read `:help add()`.
@@ -174,4 +174,4 @@
Skim `:help functions` to find some other list-related functions I haven't
mentioned yet. Run `:match Keyword /\clist/` to case-insensitively highlight
-the word "list" to make it easier to find what you're looking for.
+the word `list` to make it easier to find what you're looking for.