Loading VIP has the effect of globally binding C-z (Control-z)
to the function vip-change-mode-to-vi
. The default binding of C-z
in GNU Emacs is suspend-emacs
, but, you can also call
suspend-emacs
by typing C-x C-z. Other than this, all the
key bindings of Emacs remain the same after loading VIP.
Now, if you hit C-z, the function vip-change-mode-to-vi
will be
called and you will be in vi mode. (Some major modes may locally bind
C-z to some special functions. In such cases, you can call
vip-change-mode-to-vi
by execute-extended-command
which is
invoked by M-x. Here M-x means Meta-x, and if your
terminal does not have a META
key you can enter it by typing
ESC
x. The same effect can also be achieve by typing
M-x vip-mode.)
You can observe the change of mode by looking at the mode line. For instance, if the mode line is:
-----Emacs: *scratch* (Lisp Interaction)----All------------
then it will change to:
-----Vi: *scratch* (Lisp Interaction)----All------------
Thus the word `Emacs
' in the mode line will change to `Vi
'.
You can go back to the original emacs mode by typing C-z in vi mode. Thus C-z toggles between these two modes.
Note that modes in VIP exist orthogonally to modes in Emacs. This means that you can be in vi mode and at the same time, say, shell mode.
Vi mode corresponds to Vi's command mode. From vi mode you can enter insert mode (which corresponds to Vi's insert mode) by usual Vi command keys like i, a, o ... etc.
In insert mode, the mode line will look like this:
-----Insert *scratch* (Lisp Interaction)----All------------
You can exit from insert mode by hitting ESC
key as you do in Vi.
That VIP has three modes may seem very complicated, but in fact it is not so. VIP is implemented so that you can do most editing remaining only in the two modes for Vi (that is vi mode and insert mode).
The figure below shows the transition of three modes in VIP.