What private changes to Viper and/or Vimpulse do you have in your .emacs file?

Stephen Bach sjbach at sjbach.com
Fri Jul 23 19:48:37 CEST 2010

On Mon, Jul 19, 2010 at 10:40:38PM +0000, Jason Spiro wrote:
> Hi all,
> I am curious:  what private changes to Viper and/or Vimpulse do you have in your
> .emacs file?  You can tell us:

Some of my customizations:


(setq viper-mode t)
(setq viper-custom-file-name
      (convert-standard-filename "~/.emacs.d/dot-viper.el"))
(require 'vimpulse)
(require 'viper-in-more-modes)

;; Hack to get *Messages* in viper-mode.
;; (must be done after loading viper)
;; Futzing with fundamental-mode doesn't seem to help.
  (set-buffer "*Messages*")

;; Make Emacs mode stick out more in status bar.
(setq viper-emacs-state-id
      (concat (propertize "<EMACS>" 'face 'isearch) " "))

; Show when minibuffer is in Emacs mode.
(when (facep 'viper-minibuffer-emacs)
  (set-face-foreground 'viper-minibuffer-emacs "white")
  (set-face-background 'viper-minibuffer-emacs "black"))

;; Viper is overreaching by caring whether a visited file is under version
;; control -- disable this check.
(defadvice viper-maybe-checkout (around viper-vcs-check-is-retarded activate)

;; Remove read-only property from pasted text -- in newer versions of slime,
;; output to slime-repl is read-only and I often want to modify text I copied
;; from there.
(dolist (fn '(viper-put-back viper-Put-back))
  (eval `(defadvice ,fn (around steve-remove-read-only activate)
           (let ((text
                  ;; Taken from viper-put-back
                  (if viper-use-register
                      (cond ((viper-valid-register viper-use-register '(digit))
                              (- viper-use-register ?1) 'do-not-rotate))
                            ((viper-valid-register viper-use-register)
                             (get-register (downcase viper-use-register)))
                            (t (error viper-InvalidRegister viper-use-register)))
                      (current-kill 0))))
             (when text
               (put-text-property 0 (length text) 'read-only nil text)))

;; Simple Vim command line functions
(defun w (&optional args)
  (interactive "p")
  (save-buffer args))
(defun wq (&optional args)
  (interactive "P")
  (save-buffers-kill-emacs args))


(setq-default viper-auto-indent t)
(setq-default viper-keep-point-on-repeat nil)
(setq-default viper-toggle-key [C-up])
(setq-default viper-translate-all-ESC-keysequences nil)
(setq-default viper-change-notification-threshold 200)

;; Non-sluggish paren matching (using "%" key).
(viper-set-parsing-style-toggling-macro 'undefine)

;; C-g like ESC
(define-key viper-insert-global-user-map "\C-g" 'viper-intercept-ESC-key)
;; Map ":" to M-x.  Drop viper command mode.
(define-key viper-vi-global-user-map ":" 'execute-extended-command)
(define-key viper-vi-global-user-map ";" 'execute-extended-command)

;; Add more viper-ified modes
(setq viper-vi-state-mode-list
      (append viper-vi-state-mode-list

(setq viper-emacs-state-mode-list
      (set-difference viper-emacs-state-mode-list

;; Debugger-mode fixes
(defvar viper-debugger-mode-fixes 
  (let ((map (make-sparse-keymap)))
    (define-key map "q" 'top-level)
(viper-modify-major-mode 'debugger-mode 'vi-state viper-debugger-mode-fixes)

;; SLIME Debugger fixes
(add-hook 'sldb-mode-hook 'viper-change-state-to-vi)

;; Grep mode fixes
(defvar viper-grep-mode-fixes 
  (let ((map (make-sparse-keymap)))
    (define-key map "q" 'close-buffer-and-window-unless-last)
(viper-modify-major-mode 'grep-mode 'vi-state viper-grep-mode-fixes)

;; SLIME macroexpansion mode -- force change to viper
(defun steve-slime-temp-buffer-fixes ()
  (when (string-equal (buffer-name) "*SLIME Macroexpansion*")
(add-hook 'lisp-mode-hook 'steve-slime-temp-buffer-fixes)
(add-hook 'clojure-mode-hook 'steve-slime-temp-buffer-fixes)

;; SLIME REPL fixes
(add-hook 'slime-repl-mode-hook 'viper-comint-mode-hook)

;; SLIME *slime-events* fix
(add-hook 'slime-connected-hook
          (lambda ()
              (set-buffer (slime-events-buffer))

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : https://lists.ourproject.org/pipermail/implementations-list/attachments/20100723/1be60647/attachment-0001.pgp 

More information about the implementations-list mailing list