Modality

The original vi was invented back when "green screen" ascii terminals were the UI innovation of the day (ask your dad about ascii terminals). There wern't so many shift-like keys (shift, alt, ctrl, windows, fn) and there was no such thing as a pointing device. Let's pretend that there was only a "ctrl" key and a "shift" key, whether it's true or not.

Programming (and all other computer use) was done with your eyes on the screen and two hands on the keyboard.

Vi made it possible work this wau quickly, because vi is a bit like a video game, where any little gesture on the keyboard causes something to happen.

If you are using vim and pressing keys causes either cool or unfortunate things to happen, you know you are in the command mode, which is the default state of the editor.

Commands are assigned to the ordinary everyday keys like 'p' and 'y' and 'g', not chords like Control-Alt-Shift-Escape.

Vim has combinations and sequences to get the special power-ups like navigating between functions in separate files and reformatting entire lists in the middle of a document, code completion, abbreviations, templates and the like but that is for later.

There has to also be a way to type text into a document, but most of the keys already have special meanings!

The only reasonable option was for the developers to create an "insert mode" which would make the 'a' key type an 'a' character, just like a typewriter (ask your dad what a typewriter is). This is called "insert mode".

Not much happens in "insert mode" except normal, old, boring typing. You only want to use insert mode when you must do typing, but all the cool stuff happens in the normal (control) mode.

You will learn many convenient ways to get into insert mode, but for now you should know that the way out of insert mode, back to the video-game-like control mode, is to press the ESCAPE key.

Understanding that you have basically two modes of operation will make your stay in Vim less confusing, and starts you on your way to Vim guruhood.

No comments:

Post a Comment