How to explain VIM's modes to people?

6

1

I'm trying to explain VIM's NORMAL and INSERT modes. Is there a canonical metaphor that the Vi community has to explain the modes?

Moshe

Posted 2012-01-31T02:36:44.513

Reputation: 5 474

Answers

7

For those coming from graphical editors, this might be helpful:

In graphical user interfaces you have two input devices - the keyboard and mouse. You use the keyboard for most editing, and the mouse for moving around the document.

In VIM you have two modes that both use the keyboard. One is for moving around the document, and one is for editing the text. Normal mode is akin to using the mouse - except you're going to use the keyboard to move around the document. Edit mode is for adding text, again using the keyboard.

Adam Davis

Posted 2012-01-31T02:36:44.513

Reputation: 4 327

1I like this one. You can also add that the equivalent of menu item commands (which are again, mostly selected using the mouse) are therefore available in command mode. – Daniel Beck – 2012-01-31T10:07:52.800

3

vim has two modes, one that beeps at you, and one that destroys your document.

But honestly, I think the simplest method would be:

  • control mode: In this mode, you don't type into the file, but rather give control type statements (remove this many lines, replace this word, etc.).

  • typing / insert mode: Here, you "normally" type into the file.

adam

Posted 2012-01-31T02:36:44.513

Reputation: 473

The quote is hilarious! – Adam Davis – 2012-01-31T14:47:20.540

1

You are in INSERT mode when you add ("insert") text.

You are in NORMAL mode when you want to do something with already existing text.

romainl

Posted 2012-01-31T02:36:44.513

Reputation: 19 227

0

Most editors can be thought too of having several (at least two) modes,

  • insert mode ... where you type text in, and
  • control mode ... not by coincidence you copy, paste, cut with a Ctrl (Control) key

The only difference between (the most known in Vim, insert and normal mode) and most editors nowadays, is that most editors use keyboard shortcuts (keyboard combos, i.e. two keys pressed together) while Vim generally relies on single command keys.

There are some historical reasons why Vim does it like that, and why let's say, Emacs opted for combos, but that's another story.

Btw, who are you explaining this to?

Rook

Posted 2012-01-31T02:36:44.513

Reputation: 21 622