Leanpub Header

Skip to main content

Learn Vim

The Smart Way

The best place to learn Vim is Vim. Both vimtutor and the help file have everything you ever need. However, the average user needs something more than vimtutor and less than the help file.

Learn-Vim is an opinionated guide to learn the most useful parts of Vim in the least time possible. If you want to learn Vim and Vimscript, this is for you.

Minimum price

$12.99

$12.99

You pay

$12.99

Author earns

$10.39
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
245
Pages
About

About

About the Book

The average Vim user needs something more than vimtutor and less than the help manual. This guide attempts to bridge that gap by highlighting only the key features to learn the most useful parts of Vim in the least time possible.

Chances are you won't need all 100% of Vim features. You probably only need to know about 20% to become a powerful Vimmer. This guide will show you which Vim features you will find most useful.

This is an opinionated guide. It covers techniques that I often use when using Vim. The chapters are sequenced based on what I think would make the most logical sense for a beginner to learn Vim.

This guide is examples-heavy. When learning a new skill, examples are indispensable, having numerous examples will solidify the concepts more effectively.

You can read this guide online here entirely for free.

Purchasing this guide will keep this project sustainable and support future guides.

Some of you may wonder why do you need to learn Vimscript? In my first year of using Vim, I was content with just knowing how to use Vim. Time passed and I started needing Vimscript more and more to write custom commands for my specific editing needs. As you are mastering Vim, you will sooner or later need to learn Vimscript. So why not sooner? Vimscript is a small language. You can learn its fundamentals in just four chapters of this guide.

You can go far using Vim without knowing any Vimscript, but knowing it will help you excel even farther.

This guide is written for both beginner and advanced Vimmers. It starts out with broad and simple concepts and ends with specific and advanced concepts. If you're an advanced user already, I would encourage you to read this guide from start to finish anyway, because you will learn something new!

For more Vim tips and tricks, follow @learnvim on Twitter!

Share this book

Author

About the Author

Igor Irianto

Igor is a software developer in Dallas, TX. He works with Ruby on Rails and various Javascript frameworks.

He lives with his awesome wife and an old border collie golden retriever who likes to sleeps all day.

Contents

Table of Contents

New To Vim? Read This First

  1. Why This Guide Was Written
  2. How To Transition To Vim From Using A Different Text Editor
  3. How To Read This Guide
  4. More Help
  5. Syntax
  6. Vimrc
  7. Future, Errors, Questions
  8. I Want More Vim Tricks
  9. Thank Yous

Ch01. Starting Vim

  1. Installing
  2. The Vim Command
  3. Exiting Vim
  4. Saving A File
  5. Help
  6. Opening a File
  7. Arguments
  8. Opening Multiple Windows
  9. Suspending
  10. Starting Vim The Smart Way

Ch02. Buffers, Windows, and Tabs

  1. Buffers
  2. Exiting Vim
  3. Windows
  4. Tabs
  5. Moving In 3D
  6. Using Buffers, Windows, and Tabs The Smart Way

Ch03. Searching Files

  1. Opening And Editing Files
  2. Searching Files With Find
  3. Find And Path
  4. Searching In Files With Grep
  5. Browsing Files With Netrw
  6. Fzf
  7. Setup
  8. Fzf Syntax
  9. Finding Files
  10. Finding In Files
  11. Other Searches
  12. Replacing Grep With Rg
  13. Search And Replace In Multiple Files
  14. Learn Search The Smart Way

Ch04. Vim Grammar

  1. How To Learn A Language
  2. Grammar Rule
  3. Nouns (Motions)
  4. Verbs (Operators)
  5. Verb And Noun
  6. More Nouns (Text Objects)
  7. Composability And Grammar
  8. Learn Vim Grammar The Smart Way

Ch05. Moving In A File

  1. Character Navigation
  2. Relative Numbering
  3. Count Your Move
  4. Word Navigation
  5. Current Line Navigation
  6. Sentence And Paragraph Navigation
  7. Match Navigation
  8. Line Number Navigation
  9. Window Navigation
  10. Scrolling
  11. Search Navigation
  12. Jump
  13. Learn Navigation The Smart Way

Ch06. Insert Mode

  1. Ways To Go To Insert Mode
  2. Different Ways To Exit Insert Mode
  3. Repeating Insert Mode
  4. Deleting Chunks In Insert Mode
  5. Insert From Register
  6. Scrolling
  7. Autocompletion
  8. Executing A Normal Mode Command
  9. Learn Insert Mode The Smart Way

Ch07. The Dot Command

  1. Usage
  2. What Is A Change?
  3. Multi-line Repeat
  4. Including A Motion In A Change
  5. Learn The Dot Command The Smart Way

Ch08. Registers

  1. The Ten Register Types
  2. Register Operators
  3. Calling Registers From Insert Mode
  4. The Unnamed Register
  5. The Numbered Registers
  6. The Small Delete Register
  7. The Named Register
  8. The Read-Only Registers
  9. The Alternate File Register
  10. The Expression Register
  11. The Selection Registers
  12. The Black Hole Register
  13. The Last Search Pattern Register
  14. Viewing The Registers
  15. Executing A Register
  16. Clearing A Register
  17. Putting The Content Of A Register
  18. Learning Registers The Smart Way

Ch09. Macros

  1. Basic Macros
  2. Safety Guard
  3. Command Line Macro
  4. Executing A Macro Across Multiple Files
  5. Recursive Macro
  6. Appending A Macro
  7. Amending A Macro
  8. Macro Redundancy
  9. Series Vs Parallel Macro
  10. Learn Macros The Smart Way

Ch10. Undo

  1. Undo, Redo, And UNDO
  2. Breaking The Blocks
  3. Undo Tree
  4. Persistent Undo
  5. Time Travel
  6. Learn Undo The Smart Way

Ch11. Visual Mode

  1. The Three Types Of Visual Modes
  2. Visual Mode Navigation
  3. Visual Mode Grammar
  4. Visual Mode And Command-line Commands
  5. Adding Text On Multiple Lines
  6. Incrementing Numbers
  7. Selecting The Last Visual Mode Area
  8. Entering Visual Mode From Insert Mode
  9. Select Mode
  10. Learn Visual Mode The Smart Way

Ch12. Search And Substitute

  1. Smart Case Sensitivity
  2. First And Last Character In A Line
  3. Repeating Search
  4. Searching For Alternative Words
  5. Setting The Start And End Of A Match
  6. Searching Character Ranges
  7. Searching For Repeating Characters
  8. Predefined Character Ranges
  9. Search Example: Capturing A Text Between A Pair Of Similar Characters
  10. Search Example: Capturing A Phone Number
  11. Basic Substitution
  12. Repeating The Last Substitution
  13. Substitution Range
  14. Pattern Matching
  15. Substitution Flags
  16. Changing The Delimiter
  17. Special Replace
  18. Alternative Patterns
  19. Substituting The Start And The End Of A Pattern
  20. Greedy And Non-Greedy
  21. Substituting Across Multiple Files
  22. Substituting Across Multiple Files With Macros
  23. Learning Search And Substitution The Smart Way

Ch13. The Global Command

  1. Global Command Overview
  2. Inverse Match
  3. Pattern
  4. Passing A Range
  5. Normal Command
  6. Executing A Macro
  7. Recursive Global Command
  8. Changing The Delimiter
  9. The Default Command
  10. Reversing The Entire Buffer
  11. Aggregating All TODOs
  12. Black Hole Delete
  13. Reduce Multiple Empty Lines To One Empty Line
  14. Advanced Sort
  15. Learn The Global Command The Smart Way

Ch14. External Commands

  1. The Bang Command
  2. Reading The STDOUT Of A Command Into Vim
  3. Writing The Buffer Content Into An External Command
  4. Executing An External Command
  5. Filtering Texts
  6. Normal Mode Command
  7. Learn External Commands The Smart Way

Ch15. Command-line Mode

  1. Entering And Exiting The Command-line Mode
  2. Repeating The Previous Command
  3. Command-line Mode Shortcuts
  4. Register And Autocomplete
  5. History Window And Command-line Window
  6. More Command-line Commands
  7. Learn Command-line Mode The Smart Way

Ch16. Tags

  1. Tag Overview
  2. Tag Generator
  3. Tags Anatomy
  4. The Tag File
  5. Generating Tags For A Large Project
  6. Tags Navigation
  7. Tag Priority
  8. Selective Tag Jumps
  9. Autocompletion With Tags
  10. Tag Stack
  11. Automatic Tag Generation
  12. Generate A Tag On Save
  13. Using Plugins
  14. Ctags And Git Hooks
  15. Learn Tags The Smart Way

Ch17. Fold

  1. Manual Fold
  2. Different Fold Methods
  3. Indent Fold
  4. Marker Fold
  5. Syntax Fold
  6. Expression Fold
  7. Diff Fold
  8. Persisting Fold
  9. Learn Fold The Smart Way

Ch18. Git

  1. Diffing
  2. Vim As A Merge Tool
  3. Git Inside Vim
  4. Plugins
  5. Vim-fugitive
  6. Git Status
  7. Git Blame
  8. Gdiffsplit
  9. Gwrite And Gread
  10. Gclog
  11. More Vim-Fugitive
  12. Learn Vim And Git The Smart Way

Ch19. Compile

  1. Compile From the Command Line
  2. The Make Command
  3. Compiling With Make
  4. Different Make Program
  5. Auto-compile On Save
  6. Switching Compiler
  7. Creating A Custom Compiler
  8. Async Compiler
  9. Plugin: Vim-dispatch
  10. Learn Compile The Smart Way

Ch20. Views, Sessions, And Viminfo

  1. View
  2. Sessions
  3. Viminfo
  4. Using Views, Sessions, And Viminfo The Smart Way

Ch21. Vimrc

  1. How Vim Finds Vimrc
  2. What To Put In My Vimrc?
  3. Basic Vimrc Content
  4. Organizing Vimrc
  5. Running Vim With Or Without Vimrc And Plugins
  6. Configure Vimrc The Smart Way

Ch22. Vim Packages

  1. Pack Directory
  2. Two Types Of Loading
  3. Organizing packages
  4. Adding Packages The Smart Way

Ch23. Vim Runtime

  1. Runtime Path
  2. Plugin Scripts
  3. Filetype Detection
  4. File Type Plugin
  5. Indent Files
  6. Colors
  7. Syntax Highlighting
  8. Documentation
  9. Lazy Loading Scripts
  10. After Scripts
  11. $VIMRUNTIME
  12. Runtimepath Option
  13. Learn Runtime The Smart Way

Ch24. Vimscript Basic Data Types

  1. Data Types
  2. Following Along With Ex Mode
  3. Number
  4. Float
  5. String
  6. List
  7. Dictionary
  8. Special Primitives
  9. Learn Data Types The Smart Way

Ch25. Vimscript Conditionals And Loops

  1. Relational Operators
  2. If
  3. Ternary Expression
  4. Or
  5. And
  6. For
  7. While
  8. Error Handling
  9. Learn conditionals the smart way

Ch26. Vimscript Variables And Scopes

  1. Mutable And Immutable Variables
  2. Variable Sources
  3. Variable Scopes
  4. Using Vim Variable Scopes The Smart Way

Ch27. Vimscript Functions

  1. Function Syntax Rules
  2. Listing Available Functions
  3. Removing A Function
  4. Function Return Value
  5. Formal Arguments
  6. Function Local Variable
  7. Calling A Function
  8. Default Argument
  9. Variable Arguments
  10. Range
  11. Dictionary
  12. Funcref
  13. Lambda
  14. Method Chaining
  15. Closure
  16. Learn Vimscript Functions The Smart Way

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