Vim Reference Guide is intended as a concise learning resource for beginner to intermediate level Vim users. It has more in common with cheatsheets than a typical text book. Most features are presented using a sample usage. Topics like Regular Expressions and Macros have more detailed explanations and examples due to their complexity.

The features covered in this guide are shaped and limited by my own experiences since 2007. Fourteen years would seem a long time to have already become an expert, but I'm not there yet (nor do I have a pressing need for such expertise). The earlier version of this guide was written five years back and I still took more than three months to get it fit for publication. A large portion of that time was spent correcting my understanding of Vim commands, going through user and reference manuals, getting good at using built-in help, learning more features and so on.


I do give a brief introduction to get started with using Vim, but having prior experience would be ideal before using this resource. As a minimum requirement, you should be able to use vimtutor on your own.

info See my Vim curated list for links to tutorials, books, interactive resources, cheatsheets, tips, tricks, forums and so on.


  • This guide is based on Vim version 8.1 and some instructions assume Unix/Linux like operating system. Where possible, details and resources are mentioned for other platforms.
  • I prefer using GVim, so you might find some differences if you are using Vim.
  • Built-in help command examples are also linked to an online version. For example, clicking :h usr_toc.txt will take you to table of contents for Vim User Manual. :h usr_toc.txt is also a command that you can use from within Vim.
  • External links are provided throughout the book for exploring some topics in more depth.
  • vim_reference repo has markdown source and other details related to the book. If you are not familiar with git command, click the Code button on the webpage to get the files.

How to use this guide

  • Since many chapters take the form of cheatsheet with examples, this is a densely packed guide. Feel free to skim read some sections (because you already know them, not applicable for your use cases, etc), but try not to skip them entirely.
  • If you are not able to understand a particular feature, go through the Vim user manual for that topic first. Each chapter has related documentation links at the top and external learning resources are often mentioned at the end of command descriptions.
  • Practice the commands multiple times to build muscle memory.
  • Building your own cheatsheet is highly recommended. You wouldn't need to refer most of the basic commands often, so you'll end up with a manageable reference sheet. As you continue to build muscle memory, you can prune the cheatsheet further.
  • This guide covers a lot, but not everything. So, you'll need to learn from other resources too and add to your personal cheatsheet.


Feedback and Errata

I would highly appreciate if you'd let me know how you felt about this book, it would help to improve this book as well as my future attempts. Also, please do let me know if you spot any error or typo.

Issue Manager:



Author info

Sundeep Agarwal is a lazy being who prefers to work just enough to support his modest lifestyle. He accumulated vast wealth working as a Design Engineer at Analog Devices and retired from the corporate world at the ripe age of twenty-eight. Unfortunately, he squandered his savings within a few years and had to scramble trying to earn a living. Against all odds, selling programming ebooks saved his lazy self from having to look for a job again. He can now afford all the fantasy ebooks he wants to read and spends unhealthy amount of time browsing the internet.

When the creative muse strikes, he can be found working on yet another programming ebook (which invariably ends up having at least one example with regular expressions). Researching materials for his ebooks and everyday social media usage drowned his bookmarks, so he maintains curated resource lists for sanity sake. He is thankful for free learning resources and open source tools. His own contributions can be found at

List of books:


This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

Code snippets are available under MIT License

Resources mentioned in Acknowledgements section above are available under original licenses.

Book version


See to track changes across book versions.