--- a/acknowledgements.markdown Wed Apr 03 20:20:08 2013 -0400
+++ b/acknowledgements.markdown Wed Apr 03 20:58:01 2013 -0400
@@ -15,3 +15,4 @@
* [manojkumarm](https://github.com/manojkumarm)
* [dmedvinsky](https://github.com/dmedvinsky)
* [flatcap](https://github.com/flatcap)
+
--- a/chapters/01.markdown Wed Apr 03 20:20:08 2013 -0400
+++ b/chapters/01.markdown Wed Apr 03 20:58:01 2013 -0400
@@ -12,7 +12,7 @@
:::vim
:echo "Hello, world!"
-You should see "Hello, world!" appear at the bottom of the window.
+You should see `Hello, world!` appear at the bottom of the window.
Persistent Echoing
------------------
@@ -22,15 +22,15 @@
:::vim
:echom "Hello again, world!"
-You should see "Hello again, world!" appear at the bottom of the window.
+You should see `Hello again, world!` appear at the bottom of the window.
To see the difference between these two commands, run the following:
:::vim
:messages
-You should see a list of messages. "Hello, world!" will *not* be in this list,
-but "Hello again, world!" *will* be in it.
+You should see a list of messages. `Hello, world!` will *not* be in this list,
+but `Hello again, world!` *will* be in it.
When you're writing more complicated Vimscript later in this book you may find
yourself wanting to "print some output" to help you debug problems. Plain old
@@ -41,9 +41,9 @@
Comments
--------
-Before moving, let's look at how to add comments. When you write Vimscript code
-(in your `~/.vimrc` file or any other one) you can add comments with the `"`
-character, like this:
+Before moving on, let's look at how to add comments. When you write Vimscript
+code (in your `~/.vimrc` file or any other one) you can add comments with the
+`"` character, like this:
:::vim
" Make space more useful
--- a/chapters/02.markdown Wed Apr 03 20:20:08 2013 -0400
+++ b/chapters/02.markdown Wed Apr 03 20:58:01 2013 -0400
@@ -56,8 +56,8 @@
:set nonumber
:set number?
-Notice how the first `:set number?` command displayed "number" while the second
-displayed "nonumber".
+Notice how the first `:set number?` command displayed `number` while the second
+displayed `nonumber`.
Options with Values
-------------------
--- a/chapters/03.markdown Wed Apr 03 20:20:08 2013 -0400
+++ b/chapters/03.markdown Wed Apr 03 20:58:01 2013 -0400
@@ -55,8 +55,8 @@
:::vim
:map <space> viw " Select word
-If you try pressing `<space>` now, something horrible will almost certainly
-happen. Why?
+If you try pressing space now, something horrible will almost certainly happen.
+Why?
When you press the space bar now, Vim thinks you want it to do what
`viw<space>"<space>Select<space>word` would do. Obviously this isn't what we
--- a/chapters/04.markdown Wed Apr 03 20:20:08 2013 -0400
+++ b/chapters/04.markdown Wed Apr 03 20:58:01 2013 -0400
@@ -77,7 +77,7 @@
us out of insert mode.
Now try the mapping. It works, but notice how you're now back in normal mode.
-This makes sense, because we told Vim that `<c-d>` should exit insert mode and
+This makes sense because we told Vim that `<c-d>` should exit insert mode and
delete a line, but we never told it to go back into insert mode.
Run one more command to fix the mapping once and for all:
@@ -93,14 +93,15 @@
Set up a mapping so that you can press `<c-u>` to convert the current word to
uppercase when you're in insert mode. Remember that `U` in visual mode will
uppercase the selection. I find this mapping extremely useful when I'm writing
-out the name of a long constant -- I type out the constant in lower case and
-then uppercase it.
+out the name of a long constant like `MAX_CONNECTIONS_ALLOWED`. I type out the
+constant in lower case and then uppercase it with the mapping instead of holding
+shift the entire time.
Add that mapping to your `~/.vimrc` file.
Set up a mapping so that you can uppercase the current word with `<c-u>` when in
*normal* mode. This will be slightly different than the previous mapping
-because you don't need to enter normal mode and you should end up back in normal
-mode instead of in insert mode.
+because you don't need to enter normal mode. You should end up back in normal
+mode at the end instead of in insert mode as well.
-Add that mapping to your `~/.vimrc` file as well.
+Add that mapping to your `~/.vimrc` file.
--- a/chapters/05.markdown Wed Apr 03 20:20:08 2013 -0400
+++ b/chapters/05.markdown Wed Apr 03 20:58:01 2013 -0400
@@ -72,9 +72,9 @@
their behavior can change if you install a plugin that maps keys they depend on.
When you install a new Vim plugin there's a good chance that you won't use and
-memorize every mapping it uses. Even if you do, you'd have to go back and look
-through your `~/.vimrc` file to make sure none of your custom mappings use a key
-that the plugin has mapped.
+memorize every mapping it creates. Even if you do, you'd have to go back and
+look through your `~/.vimrc` file to make sure none of your custom mappings use
+a key that the plugin has mapped.
This would make installing plugins tedious and error-prone. There must be
a better way.
--- a/chapters/06.markdown Wed Apr 03 20:20:08 2013 -0400
+++ b/chapters/06.markdown Wed Apr 03 20:58:01 2013 -0400
@@ -40,8 +40,8 @@
Leader
------
-Vim calls this "prefix" key "leader". You can set your leader key to whatever
-you like. Run this command:
+Vim calls this "prefix" key the "leader". You can set your leader key to
+whatever you like. Run this command:
:::vim
:let mapleader = "-"
@@ -65,17 +65,17 @@
on down the road. Defining it in one place makes it easy to change later.
Second, when someone else is looking at your `~/.vimrc` file they'll immediately
-know what you mean when you say `<leader>`, and they can simply copy your
-mapping into their own `~/.vimrc` if they like it even if they use a different
-leader.
+know what you mean when you say `<leader>`. They can simply copy your mapping
+into their own `~/.vimrc` if they like it even if they use a different leader.
Finally, many Vim plugins create mappings that start with `<leader>`. If you've
-already got it set up they'll work properly and will feel familiar.
+already got it set up they'll work properly and will feel familiar right out of
+the box.
Local Leader
------------
-Vim has a second "leader" key called "localleader". This is meant to be
+Vim has a second "leader" key called "local leader". This is meant to be
a prefix for mappings that only take effect for certain types of files, like
Python files or HTML files.
@@ -86,10 +86,10 @@
:let maplocalleader = "\\"
Notice that we have to use `\\` and not just `\` because `\` is the escape
-character in strings. You'll learn more about this later.
+character in Vimscript strings. You'll learn more about this later.
Now you can use `<localleader>` in mappings and it will work just like
-`<leader>` does, except for resolving to a different key.
+`<leader>` does (except for resolving to a different key, of course).
Feel free to change this key to something else if you don't like backslash.
--- a/chapters/07.markdown Wed Apr 03 20:20:08 2013 -0400
+++ b/chapters/07.markdown Wed Apr 03 20:58:01 2013 -0400
@@ -4,17 +4,18 @@
Before we move on to learning more Vimscript, let's find a way to make it easier
to add new mappings to our `~/.vimrc` file.
-When you're coding away furiously at a problem and realize a new mapping would
-make your life easier, you should add it to your `~/.vimrc` file right then and
-there to make sure you don't forget, but you *don't* want to lose your
+Sometimes you're coding away furiously at a problem and realize a new mapping
+would make your editing easier. You should add it to your `~/.vimrc` file right
+then and there to make sure you don't forget, but you *don't* want to lose your
concentration.
-The idea is that you want to make it easier to make it easier to edit text.
+The idea of this chapter is that you want to make it easier to make it easier to
+edit text.
That's not a typo. Read it again.
-The idea is that you want to (make it easier to (make it easier to (edit
-text))).
+The idea of this chapter is that you want to (make it easier to (make it easier
+to (edit text))).
Editing Mapping
---------------
@@ -28,7 +29,7 @@
I like to think of this command as "**e**dit my **v**imrc file".
`$MYVIMRC` is a special Vim variable that points to your `~/.vimrc` file. Don't
-worry about that for right now, just trust me that that variable works.
+worry about that for right now, just trust me that it works.
`:vsplit` opens a new vertical split. If you'd prefer a horizontal split you
can replace it with `:split`.
@@ -44,45 +45,6 @@
When you're in the middle of coding and come up with a new mapping that would
save you time it's now trivial to add it to your `~/.vimrc` file.
-Meta Efficiency
----------------
-
-This is important because part of becoming more efficient is making it *easier*
-for yourself to become more efficient!
-
-Think of it this way: suppose you're trying to become a better digital
-photographer. When you're practicing taking photos and want to see how they
-came out, you:
-
-* Take a photo.
-* Upload it to your computer.
-* Open it and see how it looks.
-
-That process probably takes a minute. What if you could improve that?
-
-Let's say you invest $50 and buy an [Eye-Fi](http://www.eye.fi/). The Eye-Fi is
-a memory card for your camera that has a built-in wifi card, so as soon as you
-snap a photo it gets transferred to your computer.
-
-I know, we're definitely living in the future. Isn't it awesome?
-
-Now you spend an hour and write a little script to automatically open the photos
-that get transferred to your computer by the Eye-Fi.
-
-You've spent $50 and one hour, but now instead of taking a full minute to check
-your work, it takes ten seconds.
-
-Assuming you charge $100 per hour for freelance work, you've got to make up one
-and a half hours of time for this investment to be worthwhile. If you're saving
-50 seconds per photo, you need to take about 109 photos for project to pay for
-itself.
-
-109 photos is *nothing*. You'd blow past that number in a day's practice
-without even noticing!
-
-The same goes for our new mapping. It saves us only a few seconds each time we
-use it, but it pays for itself if we use it often enough.
-
Sourcing Mapping
----------------
@@ -105,12 +67,12 @@
* Use `<leader>ev` to open the file.
* Add the mapping.
-* Use `ZZ` to write the file and close the split, bringing us back to where we
- were.
+* Use `:wq<cr>` (or `ZZ`) to write the file and close the split, bringing you
+ back to where you were.
* Use `<leader>sv` to source the file and make our changes take effect.
That's eight keystrokes plus whatever it takes to define the mapping. It's very
-little overhead, which reduces the chance that we break our concentration.
+little overhead, which reduces the chance of breaking focus.
Exercises
---------
@@ -121,3 +83,4 @@
Try them out a few times, adding dummy mappings each time.
Read `:help myvimrc`.
+
--- a/chapters/08.markdown Wed Apr 03 20:20:08 2013 -0400
+++ b/chapters/08.markdown Wed Apr 03 20:58:01 2013 -0400
@@ -16,7 +16,7 @@
:::text
One adn two.
-As soon as you hit space after typing the "adn" Vim will replace it with "and".
+As soon as you hit space after typing the `adn` Vim will replace it with `and`.
Correcting typos like this is a great use for abbreviations. Run these
commands:
@@ -57,7 +57,7 @@
If you want to read the *full* description of this option's format you can check
out `:help isfname`, but I'll warn you that you'd better have a beer at the
-ready if you don't want to start crying while reading.
+ready for this one.
For our purposes you can simply remember that abbreviations will be expanded
when you type anything that's not a letter, number, or underscore.
@@ -70,7 +70,7 @@
:::vim
:iabbrev @@ steve@stevelosh.com
- :iabbrev ccopy Copyright 2011 Steve Losh, all rights reserved.
+ :iabbrev ccopy Copyright 2013 Steve Losh, all rights reserved.
Feel free to replace my name and email address with your own, then enter insert
mode and try them out.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/style.txt Wed Apr 03 20:58:01 2013 -0400
@@ -0,0 +1,11 @@
+Output should be enclosed in backticks. So:
+
+ If you type `:echom "Hello!"` Vim will output `Hello`.
+
+Key mappings should be lowercase.
+
+ nnoremap <esc> ...
+
+Keep code within 70 or so cols.
+
+Prefix code blocks with :::vim or :::text.