Apr 11, 2022 4 min read

What are Vim Modes? How to Change Them?

Vim has three different modes for handling user input and processing them.
Table of Contents

Vim is a powerful text editor, and is also referred to as a modal text editor.

What does "modal text editor" mean? It means that Vim is a text editor that has a mode-based workflow. Each keystroke is paired to a command in Vim. This is in contrast to other editors where each keystroke is registered as text and is written to a text file.

So, what are these modes in Vim? Let's have a look at them.

Modes in Vim

Each mode in Vim is responsible for handling user input and processing them based on the mode you are in.

Vim has three modes. Let's discuss what each mode does.

Normal mode

The default mode that Vim opens with is Normal mode. Sometimes, Normal mode is also called Command mode.

The Normal mode is used for performing actions like navigation, text substitution, cut, copy, paste, delete, etc.

Normal mode in Vim

You cannot write in normal mode. For that, you need to switch to insert mode.

Insert mode

The Insert mode in Vim is what you have naturally come to expect from text editors. Press a few alphanumeric character keys on your keyboard and they appear in the text file that you have open.

In other words, you actually write text to a file in the insert mode of Vim editor.

Insert mode in Vim

Visual mode

Vim is a text editor designed around a terminal interface (computer mice did not exist back in the days), so you cannot use your mouse to select/highlight text.

That is why we have a Visual mode in Vim. It is used to select text with arrow keys so that various operations (like cut, copy, paste, delete, etc) can be performed on selected text.

How is it different? Well, you can start selecting from any point till any point in any line. In the normal mode, you can delete words and lines but not a selection of text. Visual mode gives you that power.

Visual mode in Vim

Visual Block mode

This mode is a subset of the Visual mode. Similar to Visual mode, this mode allows you to select text, but in as block shaped selection.

Selecting a block of text in Vim's Visual Block mode

Changing modes in Vim

Since there are multiple modes available in Vim, how do we switch between them?

cheat sheet for switching modes in Vim

From Normal mode to Insert mode, and back

As I mentioned earlier, the default mode that Vim opens in is Normal mode. It allows us to navigate between characters, words, lines and blocks of code, but it does not type the text in the file we have open.

To make it so that the keys you press are registered as text and reflected in the active file, the mode needs to be changed from Normal to Insert mode.

This can be done by pressing the i key when you are in Normal mode.

Once you get used to navigating with h, j, k, l keys and not left, right, up, down arrow keys, you will want to switch back and forth from Normal mode to Insert mode.

To switch back from Insert mode to Normal mode, press the Esc key.

Switch from Normal mode to Insert mode

When you want to select some text for manipulation, Vim has a Visual mode. To activate Visual mode, you need to be in Normal mode initially.

Pressing the v key when you are in Normal mode, Vim will switch to Visual mode. Instead, if you press Ctrl + v key combination from Normal mode, you will be in Visual Block mode.

After you are done manipulating text and want to switch back to Normal mode, press the Esc key.

💡
You can not switch between Insert and Visual mode without switching to Normal mode, so that is not covered.

Conclusion

This article discusses all the modes that are available in Vim and how you can switch from one mode to another.

If you are interested in learning more than just the Vim Basics, I highly recommend using this program by Jovica Ilic.

Mastering Vim Quickly - Jovica Ilic
Exiting Mastering Vim Quickly From WTF to OMG in no time

Join the conversation

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Linux Handbook.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.