Learn Vim
$12.99
Minimum price
$12.99
Suggested price

Learn Vim

The Smart Way

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

  • Categories

    • Computers and Programming
    • Computers and Programming
  • Feedback

    Email the Author(s)

About the Author

Igor Irianto
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.

Table of Contents

  • New To Vim? Read This First
    • Why This Guide Was Written
    • How To Transition To Vim From Using A Different Text Editor
    • How To Read This Guide
    • More Help
    • Syntax
    • Vimrc
    • Future, Errors, Questions
    • I Want More Vim Tricks
    • Thank Yous
  • Ch01. Starting Vim
    • Installing
    • The Vim Command
    • Exiting Vim
    • Saving A File
    • Help
    • Opening a File
    • Arguments
    • Opening Multiple Windows
    • Suspending
    • Starting Vim The Smart Way
  • Ch02. Buffers, Windows, and Tabs
    • Buffers
    • Exiting Vim
    • Windows
    • Tabs
    • Moving In 3D
    • Using Buffers, Windows, and Tabs The Smart Way
  • Ch03. Searching Files
    • Opening And Editing Files
    • Searching Files With Find
    • Find And Path
    • Searching In Files With Grep
    • Browsing Files With Netrw
    • Fzf
    • Setup
    • Fzf Syntax
    • Finding Files
    • Finding In Files
    • Other Searches
    • Replacing Grep With Rg
    • Search And Replace In Multiple Files
    • Learn Search The Smart Way
  • Ch04. Vim Grammar
    • How To Learn A Language
    • Grammar Rule
    • Nouns (Motions)
    • Verbs (Operators)
    • Verb And Noun
    • More Nouns (Text Objects)
    • Composability And Grammar
    • Learn Vim Grammar The Smart Way
  • Ch05. Moving In A File
    • Character Navigation
    • Relative Numbering
    • Count Your Move
    • Word Navigation
    • Current Line Navigation
    • Sentence And Paragraph Navigation
    • Match Navigation
    • Line Number Navigation
    • Window Navigation
    • Scrolling
    • Search Navigation
    • Jump
    • Learn Navigation The Smart Way
  • Ch06. Insert Mode
    • Ways To Go To Insert Mode
    • Different Ways To Exit Insert Mode
    • Repeating Insert Mode
    • Deleting Chunks In Insert Mode
    • Insert From Register
    • Scrolling
    • Autocompletion
    • Executing A Normal Mode Command
    • Learn Insert Mode The Smart Way
  • Ch07. The Dot Command
    • Usage
    • What Is A Change?
    • Multi-line Repeat
    • Including A Motion In A Change
    • Learn The Dot Command The Smart Way
  • Ch08. Registers
    • The Ten Register Types
    • Register Operators
    • Calling Registers From Insert Mode
    • The Unnamed Register
    • The Numbered Registers
    • The Small Delete Register
    • The Named Register
    • The Read-Only Registers
    • The Alternate File Register
    • The Expression Register
    • The Selection Registers
    • The Black Hole Register
    • The Last Search Pattern Register
    • Viewing The Registers
    • Executing A Register
    • Clearing A Register
    • Putting The Content Of A Register
    • Learning Registers The Smart Way
  • Ch09. Macros
    • Basic Macros
    • Safety Guard
    • Command Line Macro
    • Executing A Macro Across Multiple Files
    • Recursive Macro
    • Appending A Macro
    • Amending A Macro
    • Macro Redundancy
    • Series Vs Parallel Macro
    • Learn Macros The Smart Way
  • Ch10. Undo
    • Undo, Redo, And UNDO
    • Breaking The Blocks
    • Undo Tree
    • Persistent Undo
    • Time Travel
    • Learn Undo The Smart Way
  • Ch11. Visual Mode
    • The Three Types Of Visual Modes
    • Visual Mode Navigation
    • Visual Mode Grammar
    • Visual Mode And Command-line Commands
    • Adding Text On Multiple Lines
    • Incrementing Numbers
    • Selecting The Last Visual Mode Area
    • Entering Visual Mode From Insert Mode
    • Select Mode
    • Learn Visual Mode The Smart Way
  • Ch12. Search And Substitute
    • Smart Case Sensitivity
    • First And Last Character In A Line
    • Repeating Search
    • Searching For Alternative Words
    • Setting The Start And End Of A Match
    • Searching Character Ranges
    • Searching For Repeating Characters
    • Predefined Character Ranges
    • Search Example: Capturing A Text Between A Pair Of Similar Characters
    • Search Example: Capturing A Phone Number
    • Basic Substitution
    • Repeating The Last Substitution
    • Substitution Range
    • Pattern Matching
    • Substitution Flags
    • Changing The Delimiter
    • Special Replace
    • Alternative Patterns
    • Substituting The Start And The End Of A Pattern
    • Greedy And Non-Greedy
    • Substituting Across Multiple Files
    • Substituting Across Multiple Files With Macros
    • Learning Search And Substitution The Smart Way
  • Ch13. The Global Command
    • Global Command Overview
    • Inverse Match
    • Pattern
    • Passing A Range
    • Normal Command
    • Executing A Macro
    • Recursive Global Command
    • Changing The Delimiter
    • The Default Command
    • Reversing The Entire Buffer
    • Aggregating All TODOs
    • Black Hole Delete
    • Reduce Multiple Empty Lines To One Empty Line
    • Advanced Sort
    • Learn The Global Command The Smart Way
  • Ch14. External Commands
    • The Bang Command
    • Reading The STDOUT Of A Command Into Vim
    • Writing The Buffer Content Into An External Command
    • Executing An External Command
    • Filtering Texts
    • Normal Mode Command
    • Learn External Commands The Smart Way
  • Ch15. Command-line Mode
    • Entering And Exiting The Command-line Mode
    • Repeating The Previous Command
    • Command-line Mode Shortcuts
    • Register And Autocomplete
    • History Window And Command-line Window
    • More Command-line Commands
    • Learn Command-line Mode The Smart Way
  • Ch16. Tags
    • Tag Overview
    • Tag Generator
    • Tags Anatomy
    • The Tag File
    • Generating Tags For A Large Project
    • Tags Navigation
    • Tag Priority
    • Selective Tag Jumps
    • Autocompletion With Tags
    • Tag Stack
    • Automatic Tag Generation
    • Generate A Tag On Save
    • Using Plugins
    • Ctags And Git Hooks
    • Learn Tags The Smart Way
  • Ch17. Fold
    • Manual Fold
    • Different Fold Methods
    • Indent Fold
    • Marker Fold
    • Syntax Fold
    • Expression Fold
    • Diff Fold
    • Persisting Fold
    • Learn Fold The Smart Way
  • Ch18. Git
    • Diffing
    • Vim As A Merge Tool
    • Git Inside Vim
    • Plugins
    • Vim-fugitive
    • Git Status
    • Git Blame
    • Gdiffsplit
    • Gwrite And Gread
    • Gclog
    • More Vim-Fugitive
    • Learn Vim And Git The Smart Way
  • Ch19. Compile
    • Compile From the Command Line
    • The Make Command
    • Compiling With Make
    • Different Make Program
    • Auto-compile On Save
    • Switching Compiler
    • Creating A Custom Compiler
    • Async Compiler
    • Plugin: Vim-dispatch
    • Learn Compile The Smart Way
  • Ch20. Views, Sessions, And Viminfo
    • View
    • Sessions
    • Viminfo
    • Using Views, Sessions, And Viminfo The Smart Way
  • Ch21. Vimrc
    • How Vim Finds Vimrc
    • What To Put In My Vimrc?
    • Basic Vimrc Content
    • Organizing Vimrc
    • Running Vim With Or Without Vimrc And Plugins
    • Configure Vimrc The Smart Way
  • Ch22. Vim Packages
    • Pack Directory
    • Two Types Of Loading
    • Organizing packages
    • Adding Packages The Smart Way
  • Ch23. Vim Runtime
    • Runtime Path
    • Plugin Scripts
    • Filetype Detection
    • File Type Plugin
    • Indent Files
    • Colors
    • Syntax Highlighting
    • Documentation
    • Lazy Loading Scripts
    • After Scripts
    • $VIMRUNTIME
    • Runtimepath Option
    • Learn Runtime The Smart Way
  • Ch24. Vimscript Basic Data Types
    • Data Types
    • Following Along With Ex Mode
    • Number
    • Float
    • String
    • List
    • Dictionary
    • Special Primitives
    • Learn Data Types The Smart Way
  • Ch25. Vimscript Conditionals And Loops
    • Relational Operators
    • If
    • Ternary Expression
    • Or
    • And
    • For
    • While
    • Error Handling
    • Learn conditionals the smart way
  • Ch26. Vimscript Variables And Scopes
    • Mutable And Immutable Variables
    • Variable Sources
    • Variable Scopes
    • Using Vim Variable Scopes The Smart Way
  • Ch27. Vimscript Functions
    • Function Syntax Rules
    • Listing Available Functions
    • Removing A Function
    • Function Return Value
    • Formal Arguments
    • Function Local Variable
    • Calling A Function
    • Default Argument
    • Variable Arguments
    • Range
    • Dictionary
    • Funcref
    • Lambda
    • Method Chaining
    • Closure
    • 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...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

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

In fact, authors have earnedover $13 millionwriting, 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