Leanpub Header

Skip to main content

Painless Vim

A Sane Person's Guide to the World's Most Powerful Editor

If you've ever tried to use vim and been deterred by the hideously steep learning curve, this book is for you. Painless Vim will help you get up to speed quickly and show you just how easy it is to learn vim, and how efficient you can be once you do.
Free With Membership

With Membership

Free!

$14.99

You pay

$14.99

Author earns

$11.99
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
1,014
Readers
About

About

About the Book

As I use Painless Vim, I feel like your are there learning with me rather than standing on the other side of my desk spouting information at me. Your style is very readable and that counts for so much, especially when covering a complex tool such as Vim... What I want and have found in Painless Vim is learning that is fun. --Andy Staab

Painless Vim [is] an excellent way to get acquainted with a very powerful editor. It also now includes a very well-designed and quick-to-scan cheat sheet. It’s one of the most helpful I’ve seen.Brett Terpstra

Everything You Always Wanted to Know About Vim (But Were Afraid to Ask) #painlessvim by @PogiNate

— Gábor (@gaborpro) June 11, 2014

Painless Vim is written by a professional developer who tried to learn vim a number of times before it finally stuck. I kept falling into the same cycle: I'd read a wide a array of books, online tutorials, print-outs, go through all their steps, and in the end get almost nowhere. Then I'd quietly go back to my editor of choice until next time I decided to try it out.

It wasn't until I started abusing the patience of a fellow developer who was a few months ahead of me on the vim learning curve that I came to finally understand how much power vim actually has to offer. He didn't try to tell me that I had to do everything "the vim way" or even that I had to give up my favorite editor. Instead he quietly and kindly gave me pointers that I could understand, advice I could appreciate, and encouragement to keep trying. With his help I was surprised how quickly I got comfortable with vim, and how much faster I've been ever since.

And now I want to pass that kind of learning along. Painless Vim starts with the understanding that you're an intelligent, busy person who has to get actual work done along with learning a new text editor. This book is designed to help you get comfortable with vim incrementally, without demanding that you toss your mouse out the window and disable all the keyboard shortcuts you've learned over the years. The goal is to introduce you to the 20% of vim that you'll use most often first, and give you pointers to the 80% you'll use less often when you're ready to explore.

Painless Vim is also designed to be short, easy to read, and inexpensive, so you can learn quickly and painlessly if vim is for you, without slogging through 500 pages or shelling out a ton of money just to go back to your editor of choice. I think you'll like this book, and I think that before too long you'll find that using vim is actually fun and that learning it was, well, painless.

Share this book

Author

About the Author

Nate Dickson

Nate Dickson, MBA is a scrum master by day, working for a large non-profit organization in the tops of the Rocky Mountains. By night he writes novels, plays games, and contributes to various open source projects. Nate lives in a cozy little suburb with his wife, kids, and a couple of dogs. It's a good life.

Leanpub Podcast

Episode 100

An Interview with Nate Dickson

Contents

Table of Contents

Preface

  1. Why? Why This?
  2. I’m a Stranger Here, Myself

Introduction

  1. Why Learn Vim
  2. What This Book Is
  3. What This Book Isn’t
  4. Who am I?
  5. References
  6. Sample Documents
  7. The Obligatory “Conventions Used in This Book” Section

1.Get In, Get Out, Get Comfortable

  1. Line numbers and Moving Around

2.Moving Around in Vim: Baby Steps

  1. What Are All These Modes You Keep Mentioning?
  2. More Ways Out
  3. Zoom!

3.Your .vimrc File And You

  1. Why is it called vimrc?
  2. I Was Promised Color Schemes!
  3. Using Keymaps to Get Unlost
  4. Wha?
  5. Toggling and Querying

4.Interlude: The Joy of a Good Cheat Sheet

5.Moving Around in Vim: Grown Up Steps

6.Operators 1: Changing Letters and Lines

  1. Why “yank” ?
  2. Operators Alone: Changing Single Characters
  3. Do we need two ways to delete a single letter?
  4. Operating on a Line
  5. Traditional Emacs Bashing Sections
  6. Single Caps vs. Double Taps
  7. How to Instantly Make Your Life Easier with cc (or C)

7.Doing Things More Than Once

  1. Using Counts
  2. The Exception to the Rule
  3. Using Text Objects
  4. “Commands” Don’t Sound “Painless”!
  5. Behold The All-Powerful Dot
  6. What is a “Change”?

8.Moving Around in Vim: Dance Steps

  1. Words and WORDS
  2. Inner and All
  3. Move by Counting
  4. (Book)marks

9.Modes at Last

  1. What Modes Are
  2. What is Normal, Anyway?
  3. --INSERT-- Means You Are Free to Type Normally.
  4. Command Mode: The One You’ve Been Secretly Using all This Time.
  5. How to Accidentally Enter Command Mode
  6. Visual Mode: Marking Text
  7. …And all the Rest

10.Plugins

  1. What a Plugin Is
  2. Plugins the Hard Way
  3. And Now, the Easy Way
  4. A Word About Tim Pope
  5. Nate’s Favorite Plugins

11.Operators: Moving and Changing at the Same Time

  1. Move-and-Edit Commands; or “Vim Commands 202”

12.Interlude: How to Back Off Without Giving Up

13.Registers: Clipboards as Far as the Eye Can See

  1. Say Hi to the Named Registers
  2. Little Changes, Big Changes
  3. Really Actually Deleting Stuff

14.Text Origami. :h folding

  1. Okay, But How Do I Fold Things?

15.Searching and (More Importantly) Finding

  1. Whole File Searches: / and ?
  2. Find Me Another One of These: * and #
  3. Line Searching: t/T and f/F
  4. Line Searches for Surgical Changes
  5. R…R…Regular Expressions?!?
  6. Why vim, Why??
  7. Sympathy for Vim Regexes

16.Using Vim’s Help System

  1. Getting the Help You Need
  2. Underscore vs. Hyphen
  3. Relatively Shallow Secrets of the Help System

17.Doing Things at Vim Speed

  1. Couldn’t you just remap the Caps Lock key and press <Caps Lock>+s to save things with just two ergonomic keystrokes?

18.Mapping Keys

  1. All the Key map Commands
  2. Don’t Try This at Home!
  3. Take me to your <Leader> Key!
  4. Didn’t you say that just about every key on the keyboard is already mapped?
  5. What not to map
  6. What to Map
  7. Caps Lock Must Die!
  8. <Plug>
  9. Recursive Mappings, and How to Avoid Them
  10. Hey! What’s this abbr Thing?

19.Fancy Insert Mode Tricks

  1. <ctrl>x Adventures
  2. <ctrl>r Funtimes
  3. Completions!

20.Vim Windows Are Not Microsoft Windows

  1. Opening and Closing Windows :h opening-window
  2. Window Commands begin with <ctrl>w
  3. Moving Between Windows :h window-move-cursor
  4. Resizing Windows h: window-resize
  5. Moving Windows Around :h window-moving

21.Tab Pages Are Not Browser Tabs

  1. How To Use Tab Pages :h tabpage

22.Interlude: Reviewing Views

  1. Files
  2. Windows
  3. Tabs

23.How Vim Thinks

  1. You Don’t Edit Files, you Edit Buffers
  2. Updating Vim

24.Visual (Mode) Basics :h visual-mode

  1. Characterwise Visual Mode :h characterwise-visual
  2. Linewise Visual Mode :h linewise-visual
  3. Blockwise Visual Mode :h blockwise-visual
  4. Common Visual Mode Commands

25.Vim GUIs

  1. Setting Expectations, Then Setting Some Settings
  2. Setting the Font in gvim
  3. Why Are My Colors Different In Gvim?

26.Menus Everywhere! :h menus

  1. Why would I want menus?
  2. Make Sure You Test on a Git-Controlled File!
  3. Adding a Menu
  4. Keeping Things In Order
  5. Making the Menu Come to You
  6. Linux and Windows
  7. MacVim is a Special Snowflake!

27.Literary Vim: Writing Prose in Vim

  1. Writing and Coding
  2. Setting up the a Writing Workflow
  3. What is Markdown?
  4. Writer-Friendly Vim Settings
  5. Spreading the Word: How to Get Your Message Out Into the World
  6. More Formats! I Need More Formats!

28.Conclusion

Appendix 1: Links to References

  1. Color Scheme References
  2. Cheat Sheets
  3. Great Books on vim
  4. Great Sites to Learn more Vim
  5. More About Expressions
  6. Bundle Managers

Appendix 2: Quick Reference Charts

  1. Motions
  2. Commands
  3. Text Objects
  4. Registers
  5. Folding
  6. Menus
  7. Tab Commands

Appendix 3: Sample .vimrc files

  1. Comments in vim

About This Book

  1. About the Text
  2. About the cover

Special Thanks

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub