Mercurial > emacs
changeset 16135:102e7d27c135
*** empty log message ***
author | Michael Kifer <kifer@cs.stonybrook.edu> |
---|---|
date | Fri, 06 Sep 1996 01:17:30 +0000 |
parents | 7558d82368f9 |
children | de1340e6ddb4 |
files | lisp/emulation/viper.el |
diffstat | 1 files changed, 250 insertions(+), 125 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emulation/viper.el Thu Sep 05 20:33:58 1996 +0000 +++ b/lisp/emulation/viper.el Fri Sep 06 01:17:30 1996 +0000 @@ -8,7 +8,7 @@ ;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. -(defconst viper-version "2.90 of June 19, 1996" +(defconst viper-version "2.91 of August 5, 1996" "The current version of Viper") ;; This file is part of GNU Emacs. @@ -338,6 +338,12 @@ ;;; Viper minor modes ;; This is not local in Emacs, so we make it local. +;; This must be local because although the stack of minor modes can be the same +;; for all buffers, the associated *keymaps* can be different. In Viper, +;; vip-vi-local-user-map, vip-insert-local-user-map, and others can have +;; different keymaps for different buffers. +;; Also, the keymaps associated with vip-vi/insert-state-modifier-minor-mode +;; can be different. (make-variable-buffer-local 'minor-mode-map-alist) ;; Mode for vital things like \e, C-z. @@ -478,22 +484,31 @@ (vip-deflocalvar vip-replace-overlay nil "") (put 'vip-replace-overlay 'permanent-local t) -(if (vip-has-face-support-p) - (progn - (make-face 'vip-replace-overlay-face) - (vip-hide-face 'vip-replace-overlay-face) - (or (face-differs-from-default-p 'vip-replace-overlay-face) - (progn - (if (vip-can-use-colors "darkseagreen2" "Black") - (progn - (set-face-background - 'vip-replace-overlay-face "darkseagreen2") - (set-face-foreground 'vip-replace-overlay-face "Black"))) - (set-face-underline-p 'vip-replace-overlay-face t)) - ))) - -(defvar vip-replace-overlay-face 'vip-replace-overlay-face - "*Face for highlighting replace regions on a window display.") +(defvar vip-replace-overlay-pixmap "gray3" + "Pixmap to use for search face on non-color displays.") +(defvar vip-search-face-pixmap "gray3" + "Pixmap to use for search face on non-color displays.") + + +(defun vip-set-replace-overlay-face () + (if (vip-has-face-support-p) + (defvar vip-replace-overlay-face + (progn + (make-face 'vip-replace-overlay-face) + (vip-hide-face 'vip-replace-overlay-face) + (or (face-differs-from-default-p 'vip-replace-overlay-face) + (progn + (if (vip-can-use-colors "darkseagreen2" "Black") + (progn + (set-face-background + 'vip-replace-overlay-face "darkseagreen2") + (set-face-foreground 'vip-replace-overlay-face "Black"))) + (set-face-underline-p 'vip-replace-overlay-face t) + (vip-set-face-pixmap + 'vip-replace-overlay-face vip-replace-overlay-pixmap))) + 'vip-replace-overlay-face) + "*Face for highlighting replace regions on a window display.") + )) (defvar vip-replace-region-end-delimiter "$" "A string marking the end of replacement regions. @@ -503,12 +518,10 @@ "A string marking the beginning of replacement regions. It is used only with TTYs or if `vip-use-replace-region-delimiters' is non-nil.") -(defvar vip-use-replace-region-delimiters - (or (not (vip-has-face-support-p)) (not (vip-color-display-p))) +(defvar vip-use-replace-region-delimiters (not (vip-has-face-support-p)) "*If non-nil, Viper will always use `vip-replace-region-end-delimiter' and `vip-replace-region-start-delimiter' to delimit replacement regions, even on -color displays. By default, the delimiters are used only on TTYs or -monochrome displays.") +color displays. By default, the delimiters are used only on TTYs.") ;; XEmacs requires glyphs (if vip-xemacs-p @@ -563,21 +576,8 @@ ;; Current mode. One of: `emacs-state', `vi-state', `insert-state' (vip-deflocalvar vip-current-state 'emacs-state) - -(defvar vip-toggle-key "\C-z" - "The key used to change states from emacs to Vi and back. -In insert mode, this key also functions as Meta. -Must be set in .vip file or prior to loading Viper. -This setting cannot be changed interactively.") - -(defvar vip-ESC-key "\e" - "Key used to ESC. -Must be set in .vip file or prior to loading Viper. -This setting cannot be changed interactively.") - (defvar vip-no-multiple-ESC t "*If true, multiple ESC in Vi mode will cause bell to ring. -\_ is then mapped to Meta. This is set to t on a windowing terminal and to 'twice on a dumb terminal (unless the user level is 1, 2, or 5). On a dumb terminal, this enables cursor keys and is generally more convenient, as terminals usually @@ -821,8 +821,13 @@ (defvar vip-always t "t means, arrange that vi-state will be a default.") -(defvar vip-custom-file-name - (convert-standard-filename "~/.vip") +(defvar vip-custom-file-name (cond (vip-vms-os-p "sys$login:.vip") + ((memq system-type '(emx ms-dos)) + "/_vip") + ((memq system-type '(windows-nt windows-95)) + "~/_vip") + (t ; Unix + "~/.vip")) "Viper customisation file. This variable must be set _before_ loading Viper.") @@ -927,7 +932,7 @@ "Movement commands") (vip-test-com-defun vip-movement-command) -;; Commands that can be repeated by .(dotted) +;; Commands that can be repeated by . (dotted) (defconst vip-dotable-commands '(?c ?d ?C ?D ?> ?<)) (vip-test-com-defun vip-dotable-command) @@ -939,6 +944,14 @@ (defconst vip-regsuffix-commands '(?d ?y ?Y ?D ?p ?P ?x ?X)) (vip-test-com-defun vip-regsuffix-command) +(defconst vip-vi-commands (append vip-movement-commands + vip-dotable-commands + vip-charpair-commands + vip-hash-cmds + vip-prefix-commands + vip-regsuffix-commands) + "The list of all commands in Vi-state.") +(vip-test-com-defun vip-vi-command) ;;; Arrange the keymaps @@ -1272,7 +1285,7 @@ 4. Viper supports multiple undo: `u' will undo. Typing `.' will repeat undo. Another `u' changes direction. - 6. Emacs Meta functions are invoked by typing `_' or `\\ ESC'. + 6. Emacs Meta functions are invoked by typing `C-\\' or `\\ ESC'. On a window system, the best way is to use the Meta-key. 7. Try \\[keyboard-quit] and \\[abort-recursive-edit] repeatedly,if something funny happens. This would abort the current editing command. @@ -1487,20 +1500,24 @@ ARG is used as the prefix value for the executed command. If EVENTS is a list of events, which become the beginning of the command." (interactive "P") + (if (= last-command-char ?\\) + (message "Switched to EMACS state for the next command...")) (vip-escape-to-state arg events 'emacs-state)) ;; escape to Vi mode termporarily -(defun vip-escape-to-vi () +(defun vip-escape-to-vi (arg) "Escape from Emacs state to Vi state for one Vi 1-character command. -This doesn't work with prefix arguments or most complex commands like -cw, dw, etc. But it does work with some 2-character commands, -like dd or dr." - (interactive) - (vip-escape-to-state nil nil 'vi-state)) +If the Vi command that the user types has a prefix argument, e.g., `d2w', then +Vi's prefix argument will be used. Otherwise, the prefix argument passed to +`vip-escape-to-vi' is used." + (interactive "P") + (message "Switched to VI state for the next command...") + (vip-escape-to-state arg nil 'vi-state)) ;; Escape to STATE mode for one Emacs command. (defun vip-escape-to-state (arg events state) - (let (com key prefix-arg) + ;;(let (com key prefix-arg) + (let (com key) ;; this temporarily turns off Viper's minor mode keymaps (vip-set-mode-vars-for state) (vip-normalize-minor-mode-map-alist) @@ -1508,23 +1525,26 @@ ;; protect against keyboard quit and other errors (condition-case nil - (progn + (let (vip-vi-kbd-minor-mode + vip-insert-kbd-minor-mode + vip-emacs-kbd-minor-mode) (unwind-protect (progn (setq com (key-binding (setq key (if vip-xemacs-p (read-key-sequence nil) (read-key-sequence nil t))))) - ;; In case of indirection--chase definitions. + ;; In case of binding indirection--chase definitions. ;; Have to do it here because we execute this command under ;; different keymaps, so command-execute may not do the ;; right thing there (while (vectorp com) (setq com (key-binding com)))) nil) - ;; exec command in the right Viper state - ;; otherwise, if we switch buffers in the escaped command, - ;; Viper's mode vars will remain those of `state'. When we return - ;; to the orig buffer, the bindings will be screwed up. + ;; Execute command com in the original Viper state, not in state + ;; `state'. Otherwise, if we switch buffers while executing the + ;; escaped to command, Viper's mode vars will remain those of + ;; `state'. When we return to the orig buffer, the bindings will be + ;; screwed up. (vip-set-mode-vars-for vip-current-state) ;; this-command, last-command-char, last-command-event @@ -1538,13 +1558,27 @@ (if (commandp com) (progn - (setq prefix-arg arg) + (setq prefix-arg (or prefix-arg arg)) (command-execute com))) ) (quit (ding)) (error (beep 1)))) - (vip-set-mode-vars-for vip-current-state)) ; set state in new buffer + ;; set state in the new buffer + (vip-set-mode-vars-for vip-current-state)) +(defun vip-exec-form-in-vi (form) + "Execute FORM in Vi state, regardless of the Ccurrent Vi state." + (let ((buff (current-buffer)) + result) + (vip-set-mode-vars-for 'vi-state) + (setq result (eval form)) + (if (not (equal buff (current-buffer))) ; cmd switched buffer + (save-excursion + (set-buffer buff) + (vip-set-mode-vars-for vip-current-state))) + (vip-set-mode-vars-for vip-current-state) + result)) + (defun vip-exec-form-in-emacs (form) "Execute FORM in Emacs, temporarily disabling Viper's minor modes. Similar to vip-escape-to-emacs, but accepts forms rather than keystrokes." @@ -1587,13 +1621,13 @@ (defun vip-ESC (arg) "Emulate ESC key in Emacs. -Prevents multiple escape keystrokes if vip-no-multiple-ESC is true. In that -case \@ will be bound to ESC. If vip-no-multiple-ESC is 'twice double ESC -would dings in vi-state. Other ESC sequences are emulated via the current -Emacs's major mode keymap. This is more convenient on dumb terminals and in -Emacs -nw, since this won't block functional keys such as up,down, -etc. Meta key also will work. When vip-no-multiple-ESC is nil, ESC key -behaves as in Emacs, any number of multiple escapes is allowed." +Prevents multiple escape keystrokes if vip-no-multiple-ESC is true. +If vip-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 vip-no-multiple-ESC is nil, ESC functions +as a Meta key and any number of multiple escapes is allowed." (interactive "P") (let (char) (cond ((and (not vip-no-multiple-ESC) (eq vip-current-state 'vi-state)) @@ -1608,11 +1642,21 @@ (t (ding))) )) -(defun vip-alternate-ESC (arg) - "ESC key without checking for multiple keystrokes." +(defun vip-alternate-Meta-key (arg) + "Simulate Emacs Meta key." (interactive "P") + (sit-for 1) (message "ESC-") (vip-escape-to-emacs arg '(?\e))) - + +(defun vip-toggle-key-action () + "Action bound to `vip-toggle-key'." + (interactive) + (if (and (< vip-expert-level 2) (equal vip-toggle-key "\C-z")) + (if (vip-window-display-p) + (vip-iconify) + (suspend-emacs)) + (vip-change-state-to-emacs))) + ;; Intercept ESC sequences on dumb terminals. ;; Based on the idea contributed by Marcelino Veiga Tuimil <mveiga@dit.upm.es> @@ -1783,9 +1827,9 @@ ;; Compute numeric prefix arg value. -;; Invoked by CHAR. COM is the command part obtained so far. +;; Invoked by EVENT. COM is the command part obtained so far. (defun vip-prefix-arg-value (event com) - (let (value) + (let (value func) ;; read while number (while (and (vip-characterp event) (>= event ?0) (<= event ?9)) (setq value (+ (* (if (vip-characterp value) value 0) 10) (- event ?0))) @@ -1796,11 +1840,39 @@ (while (eq event ?U) (vip-describe-arg prefix-arg) (setq event (vip-read-event-convert-to-char))) - (vip-set-unread-command-events event))) + + (if (or com (and (not (eq vip-current-state 'vi-state)) + ;; make sure it is a Vi command + (vip-characterp event) (vip-vi-command-p event) + )) + ;; If appears to be one of the vi commands, + ;; then execute it with funcall and clear prefix-arg in order to not + ;; confuse subsequent commands + (progn + ;; last-command-char is the char we want emacs to think was typed + ;; last. If com is not nil, the vip-digit-argument command was called + ;; from within vip-prefix-arg command, such as `d', `w', etc., i.e., + ;; the user typed, say, d2. In this case, `com' would be `d', `w', + ;; etc. + ;; If vip-digit-argument was invoked by vip-escape-to-vi (which is + ;; indicated by the fact that the current state is not vi-state, + ;; then `event' represents the vi command to be executed (e.g., `d', + ;; `w', etc. Again, last-command-char must make emacs believe that + ;; this is the command we typed. + (setq last-command-char (or com event)) + (setq func (vip-exec-form-in-vi + (` (key-binding (char-to-string (, event)))))) + (funcall func prefix-arg) + (setq prefix-arg nil)) + ;; some other command -- let emacs do it in its own way + (vip-set-unread-command-events event)) + )) + ;; Vi operator as prefix argument." (defun vip-prefix-arg-com (char value com) - (let ((cont t)) + (let ((cont t) + cmd-info mv-or-digit-cmd) (while (and cont (memq char (list ?c ?d ?y ?! ?< ?> ?= ?# ?r ?R ?\" @@ -1834,20 +1906,23 @@ (setq char (read-char)))) (t (setq com char) - (setq char (vip-read-char-exclusive))))))) + (setq char (vip-read-char-exclusive)))))) + (if (atom com) - ;; com is a single char, so we construct prefix-arg - ;; and if char is ?, describe prefix arg, otherwise exit by - ;; pushing the char back into vip-set-unread-command-events - ;; Since char is a command, the command will execute with the prefix - ;; argument that we just constructed. + ;; `com' is a single char, so we construct the command argument + ;; and if `char' is `?', we describe the arg; otherwise + ;; we prepare the command that will be executed at the end. (progn - (setq prefix-arg (cons value com)) + (setq cmd-info (cons value com)) (while (= char ?U) - (vip-describe-arg prefix-arg) + (vip-describe-arg cmd-info) (setq char (read-char))) - (vip-set-unread-command-events char) - ) + ;; `char' is a movement command or a digit arg command---so we execute + ;; it at the very end + (setq mv-or-digit-cmd + (vip-exec-form-in-vi + (` (key-binding (char-to-string (, char))))))) + ;; as com is non-nil, this means that we have a command to execute (if (memq (car com) '(?r ?R)) ;; execute apropriate region command. @@ -1868,7 +1943,13 @@ ((equal com '(?> . ?>)) (vip-line (cons value ?>))) ((equal com '(?! . ?!)) (vip-line (cons value ?!))) ((equal com '(?= . ?=)) (vip-line (cons value ?=))) - (t (error "")))))) + (t (error ""))))) + + (if mv-or-digit-cmd + (progn + (setq last-command-char char) + (funcall mv-or-digit-cmd cmd-info))) + )) (defun vip-describe-arg (arg) (let (val com) @@ -1886,8 +1967,8 @@ "Begin numeric argument for the next command." (interactive "P") (vip-leave-region-active) - (vip-prefix-arg-value last-command-char - (if (consp arg) (cdr arg) nil))) + (vip-prefix-arg-value + last-command-char (if (consp arg) (cdr arg) nil))) (defun vip-command-argument (arg) "Accept a motion command as an argument." @@ -2537,8 +2618,8 @@ (progn (set-face-background 'vip-search-face "khaki") (set-face-foreground 'vip-search-face "Black")) - (copy-face 'italic 'vip-search-face) - (set-face-underline-p 'vip-search-face t))) + (set-face-underline-p 'vip-search-face t) + (vip-set-face-pixmap 'vip-search-face vip-search-face-pixmap))) 'vip-search-face) "*Face used to flash out the search pattern.") )) @@ -3905,21 +3986,30 @@ (setq scroll-step 1) -(defun vip-scroll (arg) +(defun vip-scroll-screen (arg) "Scroll to next screen." (interactive "p") - (if (> arg 0) - (while (> arg 0) - (scroll-up) - (setq arg (1- arg))) - (while (> 0 arg) - (scroll-down) - (setq arg (1+ arg))))) - -(defun vip-scroll-back (arg) + (condition-case nil + (if (> arg 0) + (while (> arg 0) + (scroll-up) + (setq arg (1- arg))) + (while (> 0 arg) + (scroll-down) + (setq arg (1+ arg)))) + (error (beep 1) + (if (> arg 0) + (progn + (message "End of buffer") + (goto-char (point-max))) + (message "Beginning of buffer") + (goto-char (point-min)))) + )) + +(defun vip-scroll-screen-back (arg) "Scroll to previous screen." (interactive "p") - (vip-scroll (- arg))) + (vip-scroll-screen (- arg))) (defun vip-scroll-down (arg) "Pull down half screen." @@ -4084,7 +4174,7 @@ (search-failed (if (and (not fail-if-not-found) vip-search-wrap-around-t) (progn - (message "Search wrapped around end of buffer") + (message "Search wrapped around BOTTOM of buffer") (goto-char (point-min)) (vip-search string forward (cons 1 com) t start-point 'fail) ;; don't wait in macros @@ -4111,7 +4201,7 @@ (search-failed (if (and (not fail-if-not-found) vip-search-wrap-around-t) (progn - (message "Search wrapped around beginning of buffer") + (message "Search wrapped around TOP of buffer") (goto-char (point-max)) (vip-search string forward (cons 1 com) t start-point 'fail) ;; don't wait in macros @@ -4743,6 +4833,7 @@ (if (and (vip-same-line (point) vip-last-jump) (= (point) vip-last-jump-ignore)) (goto-char vip-last-jump)) + (if (null (mark t)) (error "Mark is not set in this buffer")) (if (= (point) (mark t)) (pop-mark)) (exchange-point-and-mark) (setq vip-last-jump (point-marker) @@ -4943,13 +5034,10 @@ vip-ex-style-editing-in-insert t vip-want-ctl-h-help nil) - (cond - ;; a novice or a beginner - ((eq vip-expert-level 1) - (global-set-key vip-toggle-key ;; in emacs-state - (if (vip-window-display-p) - 'vip-iconify - 'suspend-emacs)) + (cond ((eq vip-expert-level 1) ; novice or beginner + (global-set-key ; in emacs-state + vip-toggle-key + (if (vip-window-display-p) 'vip-iconify 'suspend-emacs)) (setq vip-no-multiple-ESC t vip-re-search t vip-vi-style-in-minibuffer t @@ -4957,8 +5045,8 @@ vip-want-emacs-keys-in-vi nil vip-want-emacs-keys-in-insert nil)) - ;; an intermediate to guru ((and (> vip-expert-level 1) (< vip-expert-level 5)) + ;; intermediate to guru (setq vip-no-multiple-ESC (if (vip-window-display-p) t 'twice) vip-want-emacs-keys-in-vi t vip-want-emacs-keys-in-insert (> vip-expert-level 2)) @@ -4983,9 +5071,9 @@ (cdr (assoc 'vip-no-multiple-ESC vip-saved-user-settings)))))) - ;; A wizard + ;; A wizard!! ;; Ideally, if 5 is selected, a buffer should pop up to let the - ;; user toggle variable values. + ;; user toggle the values of variables. (t (setq-default vip-ex-style-editing-in-insert (cdr (assoc 'vip-ex-style-editing-in-insert vip-saved-user-settings)) @@ -5365,17 +5453,11 @@ ;; This hook designed to enable Vi-style editing in comint-based modes." (defun vip-comint-mode-hook () - (setq require-final-newline nil) - (setq vip-ex-style-editing-in-insert nil + (setq require-final-newline nil + vip-ex-style-editing-in-insert nil vip-ex-style-motion nil) - (vip-add-local-keys 'vi-state - '(("\C-m" . comint-send-input) ; return - ("\C-d" . comint-delchar-or-maybe-eof))) ; \C-d - (vip-add-local-keys 'insert-state - '(("\C-m" . comint-send-input) ; return - ("\C-d" . comint-delchar-or-maybe-eof))) ; \C-d - ) - + (vip-change-state-to-insert)) + ;; This sets major mode hooks to make them come up in vi-state. (defun vip-set-hooks () @@ -5404,6 +5486,8 @@ (add-hook 'html-mode-hook 'viper-mode) (defvar html-helper-mode-hook) (add-hook 'html-helper-mode-hook 'viper-mode) + (defvar java-mode-hook) + (add-hook 'java-mode-hook 'viper-mode) (defvar emacs-lisp-mode-hook) (add-hook 'emacs-lisp-mode-hook 'viper-mode) @@ -5440,7 +5524,18 @@ (defvar emerge-startup-hook) (add-hook 'emerge-startup-hook 'vip-change-state-to-emacs) - ;; Run vip-change-state-to-vi after quitting emerge. + + ;; Tell vc-diff to put *vc* in Vi mode + (if (featurep 'vc) + (defadvice vc-diff (after vip-vc-ad activate) + "Force Vi state in VC diff buffer." + (vip-change-state-to-vi)) + (vip-eval-after-load + "vc" + '(defadvice vc-diff (after vip-vc-ad activate) + "Force Vi state in VC diff buffer." + (vip-change-state-to-vi)))) + (vip-eval-after-load "emerge" '(defadvice emerge-quit (after vip-emerge-advice activate) @@ -5473,7 +5568,10 @@ ;; Emacs shell, ange-ftp, and comint-based modes (defvar comint-mode-hook) - (add-hook 'comint-mode-hook 'vip-change-state-to-insert) + (vip-modify-major-mode + 'comint-mode 'insert-state vip-comint-mode-modifier-map) + (vip-modify-major-mode + 'comint-mode 'vi-state vip-comint-mode-modifier-map) (add-hook 'comint-mode-hook 'vip-comint-mode-hook) ;; Shell scripts @@ -5483,9 +5581,40 @@ (add-hook 'ksh-mode-hook 'viper-mode) ;; Dired - ;; This is only necessary when the user uses vip-modify-major-mode + (vip-modify-major-mode 'dired-mode 'emacs-state vip-dired-modifier-map) (add-hook 'dired-mode-hook 'vip-change-state-to-emacs) + ;; MH-E + (vip-modify-major-mode 'mh-folder-mode 'emacs-state vip-slash-and-colon-map) + ;; changing state to emacs is needed so the preceding will take hold + (add-hook 'mh-folder-mode-hook 'vip-change-state-to-emacs) + (add-hook 'mh-show-mode-hook 'viper-mode) + + ;; Gnus + (vip-modify-major-mode 'gnus-group-mode 'emacs-state vip-slash-and-colon-map) + (vip-modify-major-mode + 'gnus-summary-mode 'emacs-state vip-slash-and-colon-map) + ;; changing state to emacs is needed so the preceding will take hold + (add-hook 'gnus-group-mode-hook 'vip-change-state-to-emacs) + (add-hook 'gnus-summary-mode-hook 'vip-change-state-to-emacs) + (add-hook 'gnus-article-mode-hook 'viper-mode) + + ;; Info + (vip-modify-major-mode 'Info-mode 'emacs-state vip-slash-and-colon-map) + ;; Switching to emacs is needed so the above will take hold + (defadvice Info-mode (after vip-Info-ad activate) + "Switch to emacs mode." + (vip-change-state-to-emacs)) + + ;; Buffer menu + (vip-modify-major-mode + 'Buffer-menu-mode 'emacs-state vip-slash-and-colon-map) + ;; Switching to emacs is needed so the above will take hold + (defadvice Buffer-menu-mode (after vip-Buffer-menu-ad activate) + "Switch to emacs mode." + (vip-change-state-to-emacs)) + + ;; View mode (if vip-emacs-p (progn (defvar view-mode-hook) @@ -5566,6 +5695,7 @@ (vip-set-minibuffer-style) (vip-set-minibuffer-faces) (vip-set-search-face) +(vip-set-replace-overlay-face) (if vip-buffer-search-char (vip-buffer-search-enable)) (vip-update-alphanumeric-class) @@ -5594,15 +5724,10 @@ ;; This is taken care of by vip-insert-global-user-map. ;;(define-key vip-replace-map vip-ESC-key 'vip-intercept-ESC-key) -(define-key vip-insert-intercept-map vip-toggle-key 'vip-alternate-ESC) + ;; The default vip-toggle-key is \C-z; for the novice, it suspends or ;; iconifies Emacs -(define-key vip-vi-intercept-map vip-toggle-key - '(lambda () (interactive) - (if (and (< vip-expert-level 2) (equal vip-toggle-key "\C-z")) - (if (vip-window-display-p) (vip-iconify) (suspend-emacs)) - (vip-change-state-to-emacs)))) - +(define-key vip-vi-intercept-map vip-toggle-key 'vip-toggle-key-action) (define-key vip-emacs-intercept-map vip-toggle-key 'vip-change-state-to-vi)