;; Vi operator as prefix argument."
(defun vip-prefix-arg-com (char value com)
(let ((cont t)
- cmd-info mv-or-digit-cmd)
+ cmd-info
+ cmd-to-exec-at-end)
(while (and cont
(memq char
(list ?c ?d ?y ?! ?< ?> ?= ?# ?r ?R ?\"
(or (vip-movement-command-p char)
(vip-digit-command-p char)
(vip-regsuffix-command-p char)
+ (= char ?!) ; bang command
(error ""))
- (setq mv-or-digit-cmd
+ (setq cmd-to-exec-at-end
(vip-exec-form-in-vi
(` (key-binding (char-to-string (, char)))))))
((equal com '(?= . ?=)) (vip-line (cons value ?=)))
(t (error "")))))
- (if mv-or-digit-cmd
+ (if cmd-to-exec-at-end
(progn
(setq last-command-char char)
(setq last-command-event
(vip-copy-event
(if vip-xemacs-p (character-to-event char) char)))
(condition-case nil
- (funcall mv-or-digit-cmd cmd-info)
+ (funcall cmd-to-exec-at-end cmd-info)
(error
(error "")))))
))
(save-excursion
(set-mark vip-com-point)
(vip-enlarge-region (mark t) (point))
+ (exchange-point-and-mark)
(shell-command-on-region
(mark t) (point)
(if (= com ?!)
;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
-(defconst viper-version "2.95 of July 9, 1997"
+(defconst viper-version "2.95 of July 23, 1997"
"The current version of Viper")
;; This file is part of GNU Emacs.
:tag "Set Viper Mode on Loading"
:group 'viper)
+(defcustom viper-non-vi-major-modes nil
+ "*A list of major modes that should never come up in vi command mode.
+Viper automatically augments this list with some obvious modes, such as
+`dired-mode', `tar-mode', etc. So, don't put modes on this list, unless
+it comes up in a wrong Viper state."
+ :type 'list
+ :group 'viper)
+
+
\f
;; The following are provided for compatibility with older VIP's
(sit-for 4)
))
(viper-set-expert-level 'dont-change-unless)))
- (vip-change-state-to-vi))))
+
+ (or (memq major-mode viper-non-vi-major-modes) ; don't switch to Vi
+ (vip-change-state-to-vi)))))
\f
;; This hook designed to enable Vi-style editing in comint-based modes."
(vip-modify-major-mode 'dired-mode 'emacs-state vip-dired-modifier-map)
(vip-set-emacs-state-searchstyle-macros nil 'dired-mode)
(add-hook 'dired-mode-hook 'vip-change-state-to-emacs)
+ (setq viper-non-vi-major-modes
+ (append '(dired-mode efs-mode internal-ange-ftp-mode)
+ viper-non-vi-major-modes))
;; Tar
(vip-modify-major-mode 'tar-mode 'emacs-state vip-slash-and-colon-map)
(vip-set-emacs-state-searchstyle-macros nil 'tar-mode)
+ (setq viper-non-vi-major-modes (cons 'tar-mode viper-non-vi-major-modes))
;; 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)
+ (setq viper-non-vi-major-modes
+ (cons 'mh-folder-mode viper-non-vi-major-modes))
;; Gnus
(vip-modify-major-mode 'gnus-group-mode 'emacs-state vip-slash-and-colon-map)
(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)
+ (setq viper-non-vi-major-modes
+ (append '(gnus-group-mode gnus-summary-mode)
+ viper-non-vi-major-modes))
;; Info
(vip-modify-major-mode 'Info-mode 'emacs-state vip-slash-and-colon-map)
(defadvice Info-mode (after vip-Info-ad activate)
"Switch to emacs mode."
(vip-change-state-to-emacs))
+ (setq viper-non-vi-major-modes (cons 'Info-mode viper-non-vi-major-modes))
;; Buffer menu
(vip-modify-major-mode
(defadvice Buffer-menu-mode (after vip-Buffer-menu-ad activate)
"Switch to emacs mode."
(vip-change-state-to-emacs))
+ (setq viper-non-vi-major-modes
+ (cons 'Buffer-menu-mode viper-non-vi-major-modes))
;; View mode
(defvar view-mode-hook)
(defvar view-hook)
(add-hook 'view-hook 'vip-change-state-to-emacs)
(add-hook 'view-mode-hook 'vip-change-state-to-emacs)
+ (setq viper-non-vi-major-modes (cons 'view-mode viper-non-vi-major-modes))
;; For VM users.
;; Put summary and other VM buffers in Emacs state.
(defvar vm-summary-mode-hooks)
(add-hook 'vm-mode-hooks 'vip-change-state-to-emacs)
(add-hook 'vm-summary-mode-hooks 'vip-change-state-to-emacs)
+ (setq viper-non-vi-major-modes
+ (append '(vm-mode vm-summary-mode) viper-non-vi-major-modes))
;; For RMAIL users.
;; Put buf in Emacs state after edit.