Modern Vim
Craft Your Development Environment with Vim 8 and Neovim
by Drew Neil
Version: P1.0 (May 2018)
Copyright 2018 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/modvim, the book's homepage.
Thanks for your continued support,
Andy Hunt
The Pragmatic Programmers
The team that produced this book includes: Andy Hunt (Publisher) Janet Furlow (VP of Operations) Brian MacDonald (Managing Editor) Jacquelyn Carter (Supervising Editor) Katharine Dvorak (Development Editor) Jasmine Kwityn (Copy Editor) Potomac Indexing, LLC (Indexing) Gilson Graphics (Layout)
For customer support, please contact .
For international rights, please contact .
Table of Contents
Copyright 2018, The Pragmatic Bookshelf.
Early Praise for Modern Vim
Im once again impressed by the limitless possibilities of this classic editor. It goes without saying that I wouldand willrecommend Modern Vim to anyone using Vim, including admins, developers, and Linux enthusiasts.
Tibor Simic |
Software Developer, Ingemark |
With Practical Vim I am able to move around my text like a kangaroo. Modern Vim puts a Swiss Army knife into my pouch.
Miroslav ediv |
Software Architect, UBIMET GmbH |
Even as an experienced Vim user and plugin author, I learned a lot with this book.
Kassio Borges |
Senior Software Engineer, Zendesk, and author of the Neoterm plugin |
If youre curious as to whats new in Vim 8 and Neovim, or looking to extend the collection of great recipes started in Practical Vim, this book is an excellent resource.
Eric Casteleijn |
Vim Enthusiast |
Acknowledgments
Im grateful to have the opportunity to work with the Pragmatic Bookshelf. Thanks to Susannah Pfalzer for encouraging me to submit a proposal for another book on Vim. And thanks to Katharine Dvorak for all your help throughout the project.
This book could not have happened without the support of my wife, Hannah. Im so grateful to you for believing in me.
Modern Vim also wouldnt have been possible without my technical reviewers. Each of you contributed something and helped shape the book. Id like to thank Ali Alwasity, Kassio Borges, Eric Casteleijn, Tim Chase, Junegunn Choi, Javier Collado, Dave Copeland, Marco Hinz, Justin Keyes, Andy Lester, Janko Marohnic, Tim Pope, Steven! Ragnarok, fREW Schmidt, Miroslav ediv, Tibor Simic, Ken Takata, Tim Tyrrell, Andrew Wray, and Alex Young.
Thanks to the folks at thoughtbot, Ben Orenstein in particular, for commissioning a series of video tutorials about Vim and Neovim. This collaboration pushed me to begin working on the book and gave me a running start.
Im always grateful to everyone who works on Vim, Neovim, and the assorted plugins that make my life easer.
The Neovim logo was designed by Jason Long, and is licensed under the Creative Commons Attribution 3.0 Unported License. Weve used the one-color flat variation of the logo, because it looks best both online and in print.
The Vim logo is copyrighted. Thanks to Bram Moolenaar for granting permission to reproduce a one-color flat variation of the Vim logo in this book.
November 2017 was an unusually fruitful month. On November 1, we published the first beta edition of this book. On November 2, my wife gave birth to our son, Conrad. I could hardly believe my luck.
Footnotes
https://creativecommons.org/licenses/by/3.0
Copyright 2018, The Pragmatic Bookshelf.
Introduction
Vims core functionality makes it a good programmers text editor. Turning Vim into a full-blown development environment means combining it with other tools and extending its capabilities with plugins. In , I focused on the core features of the editor. In this book, I show you how to extend Vim and make it the centerpiece of a Unix-based IDE.
How This Book Is Structured
Modern Vim is a recipe book. Its not designed to be read from start to finish. Each chapter is a collection of tips that are related by a theme, and each tip demonstrates a particular feature in action. Some tips are self-contained. Others depend upon material elsewhere in the book. Those tips are cross-referenced so you can find everything easily.
Modern Vim doesnt progress from novice to advanced level, but each individual chapter does. A less-experienced Vim user might prefer to make a first pass through the book, reading just the early tips in each chapter. A more advanced user might choose to focus on the later tips or move around the book as needed. If it helps, you can think of this as a Choose Your Own Adventure book.