# HG changeset patch # User Steve Losh # Date 1365040677 14400 # Node ID 8a753b8685fa68e1df017f47c0efa39282876575 # Parent f09f87e10570c9dc3ad636d60da3e62a39aeea15 Proof 27-31. diff -r f09f87e10570 -r 8a753b8685fa chapters/27.markdown --- a/chapters/27.markdown Wed Apr 03 21:53:35 2013 -0400 +++ b/chapters/27.markdown Wed Apr 03 21:57:57 2013 -0400 @@ -12,13 +12,13 @@ :::vim :echom strlen("foo") -Vim displays "3", which is the length of the string "foo". Now try the +Vim displays `3`, which is the length of the string `"foo"`. Now try the following command: :::vim :echom len("foo") -Vim once again displays "3". When used with Strings `len` and `strlen` have +Vim once again displays `3`. When used with Strings `len` and `strlen` have identical effects. We'll come back to `len` later in the book. Splitting @@ -52,14 +52,14 @@ :::vim :echo join(["foo", "bar"], "...") -Vim will display "foo...bar". Don't worry about the list syntax for now. +Vim will display `foo...bar`. Don't worry about the list syntax for now. `split` and `join` can be paired to great effect. Run the following command: :::vim :echo join(split("foo bar"), ";") -Vim displays "foo;bar". First we split the string "foo bar" into a list, then +Vim displays `foo;bar`. First we split the string `"foo bar"` into a list, then we joined that list together using a semicolon as the separator. Lower and Upper Case @@ -72,7 +72,7 @@ :echom tolower("Foo") :echom toupper("Foo") -Vim displays "foo" and "FOO". This should be pretty easy to understand. +Vim displays `foo` and `FOO`. This should be pretty easy to understand. In many languages (like Python) a common idiom is to force strings to lowercase before comparing them to perform a case-insensitive comparison. In Vimscript diff -r f09f87e10570 -r 8a753b8685fa chapters/29.markdown --- a/chapters/29.markdown Wed Apr 03 21:53:35 2013 -0400 +++ b/chapters/29.markdown Wed Apr 03 21:57:57 2013 -0400 @@ -62,7 +62,7 @@ :::vim :normal! /foo -At first glance it may seem like this should perform a search for "foo", but +At first glance it may seem like this should perform a search for `foo`, but you'll see that it doesn't work. The problem is that `normal!` doesn't parse special character sequences like ``. diff -r f09f87e10570 -r 8a753b8685fa chapters/30.markdown --- a/chapters/30.markdown Wed Apr 03 21:53:35 2013 -0400 +++ b/chapters/30.markdown Wed Apr 03 21:57:57 2013 -0400 @@ -7,7 +7,7 @@ :::vim :execute "normal! gg/foo\dd" -This will move to the top of the file, search for the first occurrence of "foo", +This will move to the top of the file, search for the first occurrence of `foo`, and delete the line that contains it. Previously we tried to use `normal!` with a search command but couldn't enter diff -r f09f87e10570 -r 8a753b8685fa chapters/31.markdown --- a/chapters/31.markdown Wed Apr 03 21:53:35 2013 -0400 +++ b/chapters/31.markdown Wed Apr 03 21:57:57 2013 -0400 @@ -49,7 +49,7 @@ /print As you type in each letter, Vim will start highlighting them in the first line. -When you press return to execute the search *all* the instances of "print" will +When you press return to execute the search *all* the instances of `print` will be highlighted and your cursor will be moved to the next match. Now try running the following command: @@ -57,7 +57,7 @@ :::vim :execute "normal! gg/print\" -This will go to the top of the file and perform a search for "print", putting us +This will go to the top of the file and perform a search for `print`, putting us at the first match. It does this using `:execute "normal! ..."` which we saw in the previous chapter. @@ -67,7 +67,7 @@ :::vim :execute "normal! gg/print\n" -Vim will put the cursor on the second "print" in the buffer (and all the matches +Vim will put the cursor on the second `print` in the buffer (and all the matches will be highlighted). Let's try going in the opposite direction. Run this command: