What private changes to Viper and/or Vimpulse do you have in your .emacs file?
Hi all, I am curious: what private changes to Viper and/or Vimpulse do you have in your .emacs file? You can tell us: 1. an English-language summary of what your code does, or 2. the code itself, or 3. both. Cheers, -Jason
Jason Spiro <[email protected]> writes:
Hi all,
I am curious: what private changes to Viper and/or Vimpulse do you have in your .emacs file? You can tell us:
1. an English-language summary of what your code does, or 2. the code itself, or 3. both.
Hi Jason, nice idea; I'd definitely prefer the 2. though, i.e. let the Elisp speak for itself. Furthermore, contents of the Viper init file, which is different from .emacs/init.el is relevant, too. Also, why didn't *you* paste your customisations here to begin with? I have no .emacs; I use init.el which loads some other init files. Here are the Viper/Vimpulse-related parts with some explanations: init.el: -------- (setq viper-custom-file-name "~/.emacs.d/init/viper") (load "~/.emacs.d/init/init-vimpulse.el") ;; Don't mess with my minibuffer, bad, bad Viper! (remove-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel) ;; Don't mess with my Esc key in Vi state, bad, bad Viper! (define-key viper-vi-intercept-map viper-ESC-key nil) ; viper-intercept-ESC-key ;; Don't mess with my input methods, bad, bad Viper! (defalias 'viper-set-input-method 'ignore) (ad-deactivate 'activate-input-method) (ad-deactivate 'inactivate-input-method) (ad-deactivate 'toggle-input-method) init-vimpulse.el: ----------------- (setq vimpulse-want-vi-keys-in-apropos nil) (setq vimpulse-want-vi-keys-in-buffmenu nil) (setq vimpulse-want-vi-keys-in-dired nil) (setq vimpulse-want-vi-keys-in-help nil) (setq vimpulse-want-vi-keys-in-Info nil) (setq vimpulse-want-change-undo nil) (add-to-list 'load-path "~/Hacking/emacs/vimpulse/vimpulse") (require 'vimpulse) ;; redefine (equiv. of the famous `map Y y$') (defun viper-yank-line (arg) "Delete to the end of line." (interactive "P") (viper-goto-eol (cons arg ?y))) (vimpulse-define-text-object vimpulse-sexp (arg) "Select a S-expression." :keys '("ae" "ie") (vimpulse-inner-object-range arg 'backward-sexp 'forward-sexp)) ;; http://www.emacswiki.org/emacs/GotoChg (define-key viper-vi-basic-map "g;" 'goto-last-change) (define-key viper-vi-basic-map "g," 'goto-last-change-reverse) (define-key viper-vi-basic-map "ga" 'what-cursor-position) (define-key viper-vi-basic-map "go" 'goto-char) viper: ------ (setq-default viper-auto-indent t) (setq viper-change-notification-threshold 0 viper-expert-level 5 viper-inhibit-startup-message t viper-vi-style-in-minibuffer nil viper-want-ctl-h-help t) (setq-default viper-ex-style-editing nil) (setq-default viper-ex-style-motion nil) (setq-default viper-delete-backwards-in-replace t) ;; `.mad-to-list' is defined in yet another file like this: ;; (defun .mad-to-list (lvar els &optional append cmpfun) ;; "Add elements contained in the list ELS to LVAR. ;; In short, multi- `add-to-list', which also see for explanation of ;; the optional arguments. ;; Returns the new value of LVAR." ;; (dolist (el els (symbol-value lvar)) (add-to-list lvar el append cmpfun))) (.mad-to-list 'viper-emacs-state-mode-list '(desktop-menu-mode etags-select-mode)) (define-key viper-vi-basic-map "\C-c/" nil) ; viper-toggle-search-style (define-key viper-vi-basic-map "\C-\\" nil) ; viper-alternate-Meta-key (define-key viper-insert-basic-map "\C-\\" nil) (define-key viper-vi-basic-map "\C-^" nil) ; (viper-ex "e#") (define-key viper-insert-basic-map "\C-d" nil) ; viper-backward-indent (define-key viper-insert-basic-map "\C-t" nil) ; viper-forward-indent (define-key viper-insert-basic-map "\C-w" nil) ; viper-delete-backward-word (define-key viper-insert-basic-map (kbd "<delete>") nil) ;; see `viper-adjust-keys-for'; mind boggles... (defadvice viper-adjust-keys-for (after fuck-viper activate) (define-key viper-insert-basic-map "\C-m" nil) ; viper-autoindent (define-key viper-insert-basic-map "\C-j" nil) (define-key viper-insert-basic-map (kbd "<backspace>") nil) ; viper-del-backward-char-in-insert (define-key viper-insert-basic-map "" nil)) (define-key viper-vi-global-user-map " " 'viper-scroll-screen) (define-key viper-vi-global-user-map (kbd "<backspace>") 'viper-scroll-screen-back) (define-key viper-vi-global-user-map (kbd "DEL") 'viper-scroll-screen-back) ;; `copy-from-above-command' is defined in misc.el and comes with Emacs; ;; `copy-from-below-command' is just an adjustment of the above, left as an ;; exercise for the reader (define-key viper-insert-global-user-map (kbd "C-y") (lambda (&optional arg) (interactive "p") (copy-from-above-command arg))) (define-key viper-insert-global-user-map (kbd "C-e") (lambda (&optional arg) (interactive "p") (copy-from-below-command arg))) HOWGH. Looking forward to seeing yours! Štěpán
Addendum: Štěpán Němec <[email protected]> writes: [...]
init.el: --------
[...]
;; Don't mess with my minibuffer, bad, bad Viper! (remove-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel)
;; in post-ddfcd16209c575 Vimpulse, the above is not enough any more (defadvice viper-set-minibuffer-overlay (around fuck-viper activate) nil) [...]
On 2010-07-20 00:40, Jason Spiro wrote:
I am curious: what private changes to Viper and/or Vimpulse do you have in your .emacs file?
I have listed some of my own customizations on the Vimpulse wiki: http://trac-git.assembla.com/vimpulse/wiki/Tips%20and%20tricks -- Vegard
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))))
On Fri, Jul 23, 2010 at 11:48 AM, Stephen Bach <[email protected]> wrote:
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:
here are mine: http://gist.github.com/487857
On Fri, Jul 23, 2010 at 12:39 PM, Tim Harper <[email protected]> wrote:
On Fri, Jul 23, 2010 at 11:48 AM, Stephen Bach <[email protected]> wrote:
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:
here are mine:
What would you guys think about making the cursor-type changes a part of vimpulse? Is anyone happy with just changing the color of the cursor? Is that functionality already there somewhere, and I missed it?
Tim Harper <[email protected]> writes:
On Fri, Jul 23, 2010 at 12:39 PM, Tim Harper <[email protected]> wrote:
On Fri, Jul 23, 2010 at 11:48 AM, Stephen Bach <[email protected]> wrote:
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:
here are mine:
What would you guys think about making the cursor-type changes a part of vimpulse? Is anyone happy with just changing the color of the cursor? Is that functionality already there somewhere, and I missed it?
I think this is really a matter of personal preference, and tastes differ. AFAIK the current Vimpulse behaviour in GUI is exactly the same as in GVim, i.e. full rectangular cursor in Normal and Visual mode, bar cursor in Insert mode, half-height cursor during operator input (with a minor difference from GVim). Plus you can set the viper-FOO-state-cursor-color variables to further customize the colours. IIUC (I haven't actually tried your code), the changes in your customisation change it to: bar cursor in Emacs state, hollow rectange in Vi state, horizontal bar in Visual state. I believe (and suspect I wouldn't be the only one) particularly the former two are rather problematic -- hollow rectange is normally used to indicate point position in inactive (i.e. unfocused) windows in Emacs; and I *do* want different cursor in Emacs vs. Insert state (as is currently the case and apparently not with your customisation). So I'd leave it as is -- it's a matter of a few lines for those who want something different, and it tends to be really hard to satisfy all users in this regard, so I'd stick with the both Vim-compatible and Emacs-sane defaults. Štěpán
participants (5)
-
Jason Spiro -
Stephen Bach -
Tim Harper -
Vegard Øye -
Štěpán Němec