vim-beginner

A guide for Vim beginners

It can be challenging to transition from a full-fledged IDE (such as VScode, Intellij IDEA) to Vim. Vim has a steep learning curve, especially for beginners. As someone who has struggled to learn Vim multiple times, I understand the difficulties involved. That’s why I have created this guide to help you overcome the initial hurdles.

The key differences between this guide and other guides are that:

Four modes

Normal Mode

It’s the default mode when you first enter Vim.
The reason why this is the default mode is because we spend most of our time reviewing and updating text rather than writing new contents.
You can’t insert text directly in this mode. This is the key difference between Vim and other text editors.

Text object

A command is able to move the cursor to a specific place in the document. Text object is the content that cursor just go through.
A text object are blocks of text which can be select and manipulate as an entity.
For example:
h will move cursor to the left, thus it also represents a text object - the char on the left, dh will delete the char on the left.
l will more the cursor to the right, dl will delete the char on the right. d2l will delete 2 chars on the right.
w means word, type w will move the cursor after the current word. dw will delete the word. d2w will delete two words.
0 means start of the line, type 0 will move the cursor to the start of the line. d0 will delete the whole content that the cursor just go through.
$ means end of the line, guess what d$ will do, and give it a try.

This is not an exclusive list of text objects, more of them will be illustrated in the image.

Transitive Verb

Transitive Verb need to work with a text object. There are 3 transitive verbs.

Intransitive Verb

Intransitive Verbs are the verb can work without a text object. There are many of them. Some of the most used verbs are

Commands in Normal Mode

A tree diagram of commands in Normal Mode are illustrated below.

Commands in Normal mode

Insert Mode

The mode to insert text, like most other editors.
To enter Insert Mode, just type in

Here are some most commonly used shortcuts in Insert Mode:

Visual Mode

The mode to select texts as a text object and manipulate them with the Transitive Verb.

To enter Visual Mode, just type in

In this mode, you can use following commands:

Command-Line Mode

The mode to execute commands, to enter Command-Line Mode, just type in : in normal mode.

Here are some used commands:

Conclusion

A mind map of 4 modes in Vim will conclude the guide for Vim beginners. 4 modes in Vim

Repo: vim-beginner