46

I just started learning Linux and all my previous experience of programming has been using the Windows platform. I came across Vim editor and read that it is modal editor unlike notepad which is termed as a modeless editor.

Can you please explain what is the difference between modeless and modal editors in general?

3 Answers 3

46

A normal, "modeless" editor is like Notepad on Windows: there is only one mode, where you input text.

Vi, and it's successor Vim, are modal: there are two primary modes1, insert mode where you type text into the editor and it is committed to the document, and normal mode where you enter arguments via the keyboard that perform a variety of functions, including: moving the cursor around the document, searching, and manipulating the text in the document (for example, cutting and pasting).

The Wikipedia article on Vi has a good entry on the modal interface.

The primary appeal, originally a necessity in the early days of Unix computing prior to the widespread adoption of the mouse, is completely keyboard driven editing. This approach has now been more widely adopted in Unix-land, being used for example by a variety of web browsers.

This awesome project, Vim Clutch, provides a clear visualization of the concept of switching between modes.


1. There are also two other modes, *command mode* for entering commands as you would in a shell, and *visual mode* when selecting text to operate on.
4
  • 3
    Do not forget command line mode and visual mode.
    – Bernhard
    Commented Dec 6, 2012 at 7:02
  • Good point. I stuck to primary modes for simplicity's sake, but I will add them in as a footnote.
    – jasonwryan
    Commented Dec 6, 2012 at 7:16
  • the link "Vim Clutch" is dead
    – Rashi
    Commented Dec 28, 2018 at 4:28
  • @Rashi fixed...
    – jasonwryan
    Commented Dec 28, 2018 at 4:32
5

In user interface design, a mode is a distinct setting within a computer program or any physical machine interface, in which the same user input will produce perceived different results than it would in other settings. The best-known modal interface components are probably the Caps lock and Insert keys on the standard computer keyboard, both of which put the user's typing into a different mode after being pressed, then return it to the regular mode after being re-pressed.

An interface that uses no modes is known as a modeless interface.[1] Modeless interfaces intend to avoid mode errors[2] by making it impossible for the user to commit them.

1
  • 7
    This looks like it is copied from Wikipedia (unless you PRAMOD wrote that article, I don't know). If so, shouldn't that article be cited? Commented Jun 19, 2017 at 20:15
1

The difference is that in a modal editor you have to explicitly switch to one mode to input text. In that mode pressing a key adds that key's character to the screen where the cursor is, just like a typewriter would. Then you have to explicitly switch back to another mode to do other things like move the cursor, search, select an area, or copy text.

A modeless editor always allows you to insert text and requires you to use a modifier key if you want a key to do something other than insert a letter, such as holding Control and pressing C to copy the selected text.

They are really not that different if you think of holding a modifier key as being in a different mode. The real difference is the explicit key strokes required to switch modes. In a modeless editor you can think of a modifier key as switching to one mode while it is being pressed and then switching back to the other mode when it is released.

This part of the accepted answer is totally wrong:

The primary appeal, originally a necessity in the early days of Unix computing prior to the widespread adoption of the mouse, is completely keyboard driven editing.

Keyboard-only editing works just fine without explicit mode switching. You can move the cursor and select areas of text with key combinations. For example, Ctrl+A to move to the beginning of a line, Ctrl+Spc to set a mark followed, then Ctrl+E to move to the end of the line thus selecting the whole line.

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .