Practical Vim, Second Edition
Edit Text at the Speed of Thought
by Drew Neil
Version: P2.0 (January 2017)
Copyright 2015 The Pragmatic Programmers, LLC. This book is licensed to the individual who purchased it. We don't copy-protect it because that would limit your ability to use it for your own purposes. Please don't break this trustyou can use this across all of your devices but please do not share this copy with other members of your team, with friends, or via file sharing services. Thanks.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein.
About the Pragmatic Bookshelf
The Pragmatic Bookshelf is an agile publishing company. Were here because we want to improve the lives of developers. We do this by creating timely, practical titles, written by programmers for programmers.
Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com.
Our ebooks do not contain any Digital Restrictions Management, and have always been DRM-free. We pioneered the beta book concept, where you can purchase and read a book while its still being written, and provide feedback to the author to help make a better book for everyone. Free resources for all purchasers include source code downloads (if applicable), errata and discussion forums, all available on the book's home page at pragprog.com. Were here to make your life easier.
New Book Announcements
Want to keep up on our latest titles and announcements, and occasional special offers? Just create an account on pragprog.com (an email address and a password is all it takes) and select the checkbox to receive newsletters. You can also follow us on twitter as @pragprog.
About Ebook Formats
If you buy directly from pragprog.com, you get ebooks in all available formats for one price. You can synch your ebooks amongst all your devices (including iPhone/iPad, Android, laptops, etc.) via Dropbox. You get free updates for the life of the edition. And, of course, you can always come back and re-download your books when needed. Ebooks bought from the Amazon Kindle store are subject to Amazon's polices. Limitations in Amazon's file format may cause ebooks to display differently on different devices. For more information, please see our FAQ at pragprog.com/frequently-asked-questions/ebooks. To learn more about this book and access the free resources, go to https://pragprog.com/book/dnvim2, the book's homepage.
Thanks for your continued support,
Dave Thomas and Andy Hunt
The Pragmatic Programmers
The team that produced this book includes: Katharine Dvorak (editor) Potomac Indexing, LLC (indexer) Cathleen Small (copyeditor) Dave Thomas (layout) Janet Furlow (producer)
For customer support, please contact .
For international rights, please contact .
Table of Contents
- Index and Navigate
Source Code with ctags - Compile Code and Navigate Errors
with the Quickfix List - Search Project-Wide
with grep, vimgrep, and Others
Copyright 2017, The Pragmatic Bookshelf.
What readers are saying about Practical Vim
Ive learned more about Vim by reading this book than I have from any other resource.
Robert Evans |
Software Engineer, Code Wranglers |
After reading a couple of chapters of Practical Vim , I realized how little I knew. From intermediate to beginner in thirty minutes!
Henrik Nyh |
Software Engineer |
Practical Vim continues to change what I believe a text editor can do.
John P. Daigle |
Developer, ThoughtWorks, Inc. |
Drew has continued the wonderful work he has done with Vimcasts in this book, a must-read for anyone serious about Vim.
Anders Janmyr |
Developer, Jayway |
Practical Vim bridges the gap between the official documentation and how to really use Vim. After reading a few chapters, I switched to using Vim as my default editor. Ive never looked back.
Javier Collado |
QA Automation Engineer, Canonical Ltd. |
Drew Neil does more than show the right tool for the job. He paces the narrative, laying out the philosophy behind each decision. Instead of expecting you to memorize everything, Practical Vim teaches you to think with Vim under your fingertips.
Mislav Marohnic |
Consultant |
Ive been using Vim for server maintenance for more than fifteen years now, but Ive only recently started using it for software development. I thought I knew Vim, but Practical Vim has massively improved my code-wrangling productivity.
Graeme Mathieson |
Software Engineer, Rubaidh Ltd. |
Practical Vim made me realize how much there is still to learn about Vim. Every single tip can be easily and immediately applied to your workflow and will improve your productivity manifold.
Mathias Meyer |
Author, Riak Handbook |
Practical Vim is the ultimate treasure chest when it comes to Vim knowledge. Ive used Vim daily for over two years now, and this book has been nothing short of a revelation for me.
Felix Geisendrfer |
Cofounder, Transloadit |
Acknowledgments
Thanks to Bram Moolenaar for creating Vim and to all those who have contributed to its development. Its a timeless piece of software, and I look forward to growing with it.
Thanks to everyone at the Pragmatic Bookshelf for working together to make this book the best that it could be. Special thanks to Kay Keppler, my developmental editor, for coaching me as a writer and for helping to shape this book, despite its growing pains and my occasional tantrums. Thanks also to Katharine Dvorak, my development editor for this revised edition. Id also like to thank David Kelly for his adept handling of my unusual formatting requests.
Practical Vim didnt start out as a recipe book, but Susannah Pfalzer recognized that it would work best in this format. It was painful to have to rewrite so much, but in doing so I produced a draft that I was happy with for the first time. Susannah knows whats best, and I thank her for sharing that insight.
Thanks to Dave Thomas and Andy Hunt for creating the Pragmatic Bookshelf. I wouldnt want to be represented by any other publisher, and Im honored to be listed alongside the other titles in their catalog.
Practical Vim wouldnt have been possible without my technical reviewers. Each of you contributed something and helped to shape the book. Id like to thank Adam McCrea, Alan Gardner, Alex Kahn, Ali Alwasity, Anders Janmyr, Andrew Donaldson, Angus Neil, Charlie Tanksley, Ches Martin, Daniel Bretoi, David Morris, Denis Gorin, Elyzer Mendes Rezende, Erik St. Martin, Federico Galassi, Felix Geisendrfer, Florian Vallen, Graeme Mathieson, Hans Hasselberg, Henrik Nyh, Javier Collado, Jeff Holland, Josh Sullivan, Joshua Flanagan, Kana Natsuno, Kent Frazier, Luis Merino, Mathias Meyer, Matt Southerden, Mislav Marohnic, Mitch Guthrie, Morgan Prior, Paul Barry, Peter Aronoff, Peter Rihn, Philip Roberts, Robert Evans, Ryan Stenhouse, Steven! Ragnark, Tibor Simic, Tim Chase, Tim Pope, Tim Tyrrell, and Tobias Sailer.