A Live Developer Journal

Vim is Awesome! A Basic Helpsheet For Getting Started

Vim is a lightweight and power-packed text editor. Use it to write and edit text files straight on your server. While Vim has a steep learning curve if you want to be an expert at it, it's easy to get started for your every day projects, here is how .

What is Vim?

 Vim is an extremely powerful and lightweight text editing program that strongly encourages you to write and edit text files using the keyboard only. It contains a number of shortcuts that allow you to navigate your text file and to perform repetitive tasks easily.

 Vim also contains a vim.rc file that allows you to add features and little code snippets that your editor will run for you. This can include anything from custom syntax highlighting to allowing keywords to run specific functions, basically anything you can think of.

 Another advantage of learning Vim is that it is installed on any Unix-based system, which means that you can edit files directly on your server. Also, as Vim is designed to work on slow terminals, it feels incredibly fast to use.

How to Install Vim

 A quick and easy way to install the latest version of Vim is by using Homebrew, which you can use to install most applications to your Unix-based systems easily. You can install it here: https://brew.sh/ Though generally unix-based systems come with Vim pre-installed.

 Once you have Homebrew installed, open your terminal and enter the following command to install Vim:

$brew install vim

How to Learn Vim

 There is a huge learning curve to learning Vim at an expert level, though it is relatively easy to get started with it for your everyday projects pretty quickly by running vimtutor in the command line.

 Vim comes with Vimtutor when you install it, and it consists of 7 short tutorials that help you get to grips with the basic and most commonly used features of Vim. To run Vimtutor, open your terminal and enter the following command:


screenshot of vimtutor lesson

 The remainder of this post is a reference to the Vimtutor tutorial that is easy to come back to. You may find it useful to use this post as a basic Vim helpsheet after following the tutorial yourself. At the end of this post you will find a list of alternative more advanced/interactive resources for learning Vim.

Lesson 1.1. Moving the cursor

Lesson 1.2. Exiting Vim

Lesson 1.3. Text Editing - Deletion

 To delete the character under the cursor: x

Lesson 1.4. Text Editing - Insertion

Lesson 1.5: Text Editing - Appending

Lesson 1.6. Editing a file

Lesson 1 Summary

screenshot of vimtutor lesson

Lesson 2.1: Deletion Commands

Lesson 2.2: More Deletion Commands

Lesson 2.3: On Operators and Motions

Lesson 2.4: Using a Count for a Motion

Lesson 2.5: Using a Count to Delete More

Lesson 2.6: Operating On Lines

Lesson 2.7: The undo Command

Lesson 2 Summary

screenshot of vimtutor lesson

Lesson 3.1: The Put Command

Lesson 3.2: The Replace Command

Lesson 3.3: The Change Operator

Lesson 3.4: More Changes Using c

Lesson 3 Summary

screenshot of vimtutor lesson

Lesson 4.1: Cursor Location and File Status

Lesson 4.2: The Search command

Lesson 4.3: Matching Parenthesis Search

Lesson 4.4: The Substitute Command

Lesson 4 Summary

screenshot of vimtutor lesson

Lesson 5.1: How to Execute an External Command

Lesson 5.2: More on Writing Files

Lesson 5.3: Selecting Text to Write

Lesson 5.4: Retrieving and Merging Files

Lesson 5 Summary

screenshot of vimtutor lesson

Lesson 6: The Open Command

Lesson 6.2: The Append Command

Lesson 6.3: Another Way To Replace

Lesson 6.4: Copy and Paste Text

Lesson 6.5: Set Option

Lesson 6 Summary

screenshot of vimtutor lesson

Lesson 7.1: Getting Help

Lesson 7.2: Create a Startup Script

Lesson 7.3: Completion

Lesson 7 Summary

screenshot of vimtutor lesson

Further reading recommended by vimtutor

More Advanced/Interactive Resources For Learning Vim