Function: viper-mode
viper-mode is an autoloaded, interactive and byte-compiled function
defined in viper.el.gz.
Signature
(viper-mode)
Documentation
Turn on Viper emulation of Vi in Emacs. See Info node (viper)Top.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emulation/viper.el.gz
;;;###autoload
(defun viper-mode ()
"Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Top'."
(interactive)
(if (not noninteractive)
(progn
;; if the user requested viper-mode explicitly
(if viper-mode
()
(setq viper-mode t)
;; FIXME: Don't reload!
(load-library "viper"))
(if viper-first-time ; Important check. Prevents mix-up of startup
(progn ; and expert-level msgs when viper-mode recurses
(setq viper-first-time nil)
(if (not viper-inhibit-startup-message)
(save-window-excursion
(setq viper-inhibit-startup-message t)
(delete-other-windows)
(switch-to-buffer "Viper Startup Message")
(erase-buffer)
(insert
(substitute-command-keys
"Viper Is a Package for Emacs Rebels,
a VI Plan for Emacs Rescue, and a venomous VI PERil.
Incidentally, Viper emulates Vi under Emacs.
It supports all of what is good in Vi and Ex, while extending
and improving upon much of it.
1. Viper supports Vi at several levels. Level 1 is the closest to Vi,
level 5 provides the most flexibility to depart from many Vi conventions.
You will be asked to specify your user level in a following screen.
If you select user level 1 then the keys ^X, ^C, ^Z, and ^G will behave
as in VI, to smooth transition to Viper for the beginners. However, to
use Emacs productively, you are advised to reach user level 3 or higher.
At user level 2 or higher, ^X and ^C have Emacs, not Vi, bindings;
^Z toggles Vi/Emacs states; ^G is Emacs's keyboard-quit (like ^C in Vi).
2. Vi exit functions (e.g., :wq, ZZ) work on INDIVIDUAL files -- they
do not cause Emacs to quit, except at user level 1 (for a novice).
3. ^X^C EXITS EMACS.
4. Viper supports multiple undo: \\`u' will undo. Typing \\`.' will repeat
undo. Another \\`u' changes direction.
6. Emacs Meta key is \\`C-\\' (in all modes) or \\`\\ ESC' (in Vi command mode).
On a window system, the best way is to use the Meta-key on your keyboard.
7. Try \\[keyboard-quit] and \\[abort-recursive-edit] repeatedly,if
something funny happens. This would abort the current editing command.
For more information on Viper:
a. Type `:help' in Vi command mode
b. Print Viper manual, found in ./etc/viper.dvi
c. Print the Quick Reference, found in ./etc/viperCard.dvi
To submit a bug report or to contact the author, type \\`:submitReport' in Vi
command mode. To shoo Viper away and return to pure Emacs (horror!), type:
\\[viper-go-away]
This startup message appears whenever you load Viper, unless you type \\`y' now."
))
(goto-char (point-min))
(if (y-or-n-p "Inhibit Viper startup message? ")
(viper-save-setting
'viper-inhibit-startup-message
"Viper startup message inhibited"
viper-custom-file-name t))
;;(kill-buffer (current-buffer))
(message
"The last message is in buffer `Viper Startup Message'")
(sit-for 4)
))
(viper-set-expert-level 'dont-change-unless)))
(or (derived-mode-p viper-emacs-state-mode-list) ; don't switch to Vi
(derived-mode-p viper-insert-state-mode-list) ; don't switch
(viper-change-state-to-vi))
))
(if (eq major-mode 'viper-mode)
(setq major-mode 'fundamental-mode))
)