(or (viper-overlay-p viper-replace-overlay)
(viper-set-replace-overlay (point-min) (point-min)))
(viper-hide-replace-overlay)
- (if abbrev-mode (expand-abbrev))
+ ;; Expand abbrevs iff the previous character has word syntax.
+ (and abbrev-mode
+ (eq (char-syntax (preceding-char)) ?w)
+ (expand-abbrev))
(if (and auto-fill-function (> (current-column) fill-column))
(funcall auto-fill-function))
;; don't leave whitespace lines around
(error
(viper-message-conditions conds))))
-;; escape to emacs mode termporarily
+;; escape to emacs mode temporarily
(defun viper-escape-to-emacs (arg &optional events)
"Escape to Emacs state from Vi state for one Emacs command.
ARG is used as the prefix value for the executed command. If
(message "Switched to EMACS state for the next command..."))
(viper-escape-to-state arg events 'emacs-state))
-;; escape to Vi mode termporarily
+;; escape to Vi mode temporarily
(defun viper-escape-to-vi (arg)
"Escape from Emacs state to Vi state for one Vi 1-character command.
If the Vi command that the user types has a prefix argument, e.g., `d2w', then
"Function that implements ESC key in Viper emulation of Vi."
(interactive)
(let ((cmd (or (key-binding (viper-envelop-ESC-key))
- '(lambda () (interactive) (error "Viper bell")))))
+ (lambda () (interactive) (error "Viper bell")))))
;; call the actual function to execute ESC (if no other symbols followed)
;; or the key bound to the ESC sequence (if the sequence was issued
(insert " ")(backward-char 1)))
(if (= viper-com-point (point))
(viper-forward-char-carefully))
- (set-mark viper-com-point)
+ (push-mark viper-com-point)
(if (eq m-com 'viper-next-line-at-bol)
(viper-enlarge-region (mark t) (point)))
(if (< (point) (mark t))
(viper-backward-char-carefully)) ; give back the newline
(if (eq viper-intermediate-command 'viper-repeat)
(viper-change-subr (mark t) (point))
- (viper-change (mark t) (point))
- ))
+ (viper-change (mark t) (point))))
;; this is invoked by viper-substitute-line
(defun viper-exec-Change (m-com com)
;; call viper-execute-com to execute viper-exec-change, which eventually will
;; call viper-change to invoke the replace mode on the region.
;;
-;; The var viper-d-com is set to (M-COM VAL COM REG INSETED-TEXT COMMAND-KEYS)
+;; The var viper-d-com is set to (M-COM VAL COM REG INSERTED-TEXT COMMAND-KEYS)
;; via a call to viper-set-destructive-command, for later use by viper-repeat.
(defun viper-execute-com (m-com val com)
(let ((reg viper-use-register))
;; Quote region by each line with a user supplied string.
(defun viper-quote-region ()
(let ((quote-str viper-quote-string)
- (donot-change-dafault t))
+ (donot-change-default t))
(setq quote-str
(viper-read-string-with-history
"Quote string: "
((string-match "lisp.*-mode" (symbol-name major-mode)) ";;")
((memq major-mode '(c-mode cc-mode c++-mode)) "//")
((memq major-mode '(sh-mode shell-mode)) "#")
- (t (setq donot-change-dafault nil)
+ (t (setq donot-change-default nil)
quote-str))))
- (or donot-change-dafault
+ (or donot-change-default
(setq viper-quote-string quote-str))
(viper-enlarge-region (point) (mark t))
(if (> (point) (mark t)) (exchange-point-and-mark))
t 'local)
(add-hook
'viper-pre-command-hooks 'viper-replace-state-pre-command-sentinel t 'local)
- ;; guard against a smartie who switched from R-replace to normal replace
+ ;; guard against a smarty who switched from R-replace to normal replace
(remove-hook
'viper-post-command-hooks 'viper-R-state-post-command-sentinel 'local)
(if overwrite-mode (overwrite-mode -1))
'viper-post-command-hooks 'viper-R-state-post-command-sentinel t 'local)
(add-hook
'viper-pre-command-hooks 'viper-replace-state-pre-command-sentinel t 'local)
- ;; guard against a smartie who switched from R-replace to normal replace
+ ;; guard against a smarty who switched from R-replace to normal replace
(remove-hook
'viper-post-command-hooks 'viper-replace-state-post-command-sentinel 'local)
)
convenient way to use it is to bind `//' to the macro
`1 M-x viper-toggle-search-style' and `///' to
`2 M-x viper-toggle-search-style'. In this way, hitting `//' quickly will
-toggle case-fold-search and hitting `/' three times witth toggle regexp
+toggle case-fold-search and hitting `/' three times with toggle regexp
search. Macros are more convenient in this case because they don't affect
the Emacs binding of `/'."
(interactive "P")
"//" 'vi-state
[1 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
scope)
- ;; toggle regexp/vanila search
+ ;; toggle regexp/vanilla search
(viper-record-kbd-macro
"///" 'vi-state
[2 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
"//" 'emacs-state
[1 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
(or arg-majormode major-mode))
- ;; toggle regexp/vanila search
+ ;; toggle regexp/vanilla search
(viper-record-kbd-macro
"///" 'emacs-state
[2 (meta x) v i p e r - t o g g l e - s e a r c h - s t y l e return]
(setq viper-prefix-commands
(cons viper-buffer-search-char viper-prefix-commands)))
-;; This is a Viper wraper for isearch-forward.
+;; This is a Viper wrapper for isearch-forward.
(defun viper-isearch-forward (arg)
"Do incremental search forward."
(interactive "P")
(if (listp arg) (setq arg (car arg)))
(viper-exec-form-in-emacs (list 'isearch-forward arg)))
-;; This is a Viper wraper for isearch-backward."
+;; This is a Viper wrapper for isearch-backward."
(defun viper-isearch-backward (arg)
"Do incremental search backward."
(interactive "P")