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:

~/.emacs.d/viper-boot.el:
=========================

(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.
(save-excursion
  (set-buffer "*Messages*")
  (viper-change-state-to-vi))

;; 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)
  nil)

;; 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))
                             (current-kill
                              (- 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)))
           ad-do-it)))

;; 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))


~/.emacs.d/dot-viper.el:
=========================

(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
              '(clojure-mode
                grep-mode
                comint-mode
                slime-xref-mode
                slime-repl-mode
                sldb-mode
                debugger-mode
                completion-list-mode)))

(setq viper-emacs-state-mode-list
      (set-difference viper-emacs-state-mode-list
                      '(completion-list-mode)))

;; Debugger-mode fixes
(defvar viper-debugger-mode-fixes 
  (let ((map (make-sparse-keymap)))
    (define-key map "q" 'top-level)
    map))
(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)
    map))
(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*")
    (viper-change-state-to-vi)))
(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 ()
            (save-excursion
              (set-buffer (slime-events-buffer))
              (viper-change-state-to-vi))))

-------------- 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