preface.markdown @ 93d00f94217a

Another chapter and some tweaks.
author Steve Losh <steve@stevelosh.com>
date Thu, 13 Oct 2011 00:01:07 -0400
parents c608cbb9aaaa
children 274674dc2025
Preface
=======

Programmers shape ideas into text.

That text gets turned into numbers and those numbers bump into other numbers
and *make things happen*.

To get our ideas out of our heads and the chunks of text we call "programs" we
use text editors.  Full-time programmers will easily spend thousands of hours
of their lives interacting with their text editor doing many things:

* Getting raw text from brains into computers.
* Correcting mistakes in that text.
* Restructuring the text to formulate a problem in a different way.
* Recording how and why something was done a particular way.
* Communicating with other programmers about all of these things.

Vim is incredibly powerful out of the box, but it doesn't truly shine until you
take some time to customize it for your particular work, habits, and fingers.
This book will introduce you to Vimscript, the main programming language used to
customize Vim.  You'll be able to mold Vim around your own personal text editing
and make the rest of your time in Vim more efficient.

Along the way I'll also mention things that aren't strictly about Vimscript, but
are more about learning and being more efficient in general.  Learning Vimscript
isn't going to help you much if you wind up fiddling with your editor all day
instead of working, so you must strike a balance.

Each chapter of the book focuses on a single topic.  They're short but packed
with information, so don't just skim them.  If you really want to learn the most
you can from this book, you need to *type in* all of the commands.

You may already be an experienced programmer who's used to reading code and
understanding it straight away.  If so: it doesn't matter.  Learning Vim and
Vimscript is a different experience from learning a normal programming language.

**Type in *all* the commands.**

**Do *all* the exercises.**

Vimscript is old and has a lot of dusty corners and twisty hallways.  One
configuration option can change how the entire language works.

By typing *every* command in *every* lesson exercise and doing *every* exercise
you'll discover problems with your Vim build or configuration on the simpler
commands, which will be easier to diagnose and fix.

Second, Vimscript *is* Vim.  To save a file in Vim, you type `:write` (or `:w`
for short) and press return.  To save a file in a Vimscript, you use `write`.
Mastering a text editor means developing muscle memory, which you simply can't
get from just reading.

I hope you'll find this book useful.  It's *not* meant to be a comprehensive
guide to Vimscript.  It's meant to get you comfortable enough with the language
to read other people's code (with regular side-trips to `:help`) and recognize
some common pitfalls.