The most common way to load it automatically is to include the following lines (in the given order!):
(setq viper-mode t) (require 'viper)
in your ~/.emacs file. The .emacs file is placed in your home directory and it is be executed every time you invoke Emacs. This is the place where all general Emacs customization takes place. Emacs has an interactive interface (M-x customize), which simplifies the job of customization significantly.
Viper also uses the file ~/.emacs.d/viper for Viper-specific customization.
The location of Viper customization file can be changed by setting the
variable viper-custom-file-name
in .emacs prior to loading
Viper.
The latest versions of Emacs have an interactive customization facility,
which allows you to (mostly) bypass the use of the .emacs and
viper-custom-file-name
files. You can reach this customization
facility from within Viper’s VI state by executing the Ex command
:customize.
Once invoked, Viper will arrange to bring up Emacs buffers in Vi state whenever this makes sense. See Packages that Change Keymaps, to find out when forcing Vi command state on a buffer may be counter-productive.
Even if your .emacs file does not invoke Viper automatically, you can still load Viper and enter the Vi command state by typing the following from within Emacs:
M-x viper-mode
When Emacs first comes up, if you have not specified a file on the command line, it will show the *scratch* buffer, in the ‘Lisp Interaction’ mode. After you invoke Viper, you can start editing files by using :e, :vi, or v commands. (See File and Buffer Handling, for more information on v and other new commands that, in many cases, are more convenient than :e, :vi, and similar old-style Vi commands.)
Finally, if at some point you would want to de-Viperize your running
copy of Emacs after Viper has been loaded, the command M-x
viper-go-away will do it for you. The function toggle-viper-mode
toggles Viperization of Emacs on and off.