Function: viper-ESC
viper-ESC is an interactive and byte-compiled function defined in
viper-cmd.el.gz.
Signature
(viper-ESC ARG)
Documentation
Emulate ESC key in Emacs.
Prevents multiple escape keystrokes if viper-no-multiple-ESC is true.
If viper-no-multiple-ESC is twice double ESC would ding in vi-state.
Other ESC sequences are emulated via the current Emacs's major mode
keymap. This is more convenient on TTYs, since this won't block
function keys such as up, down, etc. ESC will also will also work as
a Meta key in this case. When viper-no-multiple-ESC is nil, ESC works
as a Meta key and any number of multiple escapes are allowed.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emulation/viper-cmd.el.gz
(defun viper-ESC (arg)
"Emulate ESC key in Emacs.
Prevents multiple escape keystrokes if viper-no-multiple-ESC is true.
If `viper-no-multiple-ESC' is `twice' double ESC would ding in vi-state.
Other ESC sequences are emulated via the current Emacs's major mode
keymap. This is more convenient on TTYs, since this won't block
function keys such as up, down, etc. ESC will also will also work as
a Meta key in this case. When `viper-no-multiple-ESC' is nil, ESC works
as a Meta key and any number of multiple escapes are allowed."
(interactive "P")
(let (char)
(cond ((and (not viper-no-multiple-ESC) (eq viper-current-state 'vi-state))
(setq char (viper-read-char-exclusive))
(viper-escape-to-emacs arg (list ?\e char) ))
((and (eq viper-no-multiple-ESC 'twice)
(eq viper-current-state 'vi-state))
(setq char (viper-read-char-exclusive))
(if (= char (string-to-char viper-ESC-key))
(ding)
(viper-escape-to-emacs arg (list ?\e char) )))
(t (ding)))
))