Advertisement
Guest User

konr

a guest
Feb 10th, 2010
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 22.74 KB | None | 0 0
  1. ;;; viper-in-more-modes.el --- vi-like keybindings for various Emacs modes
  2.  
  3. ;; Copyright (C) 2007 Alessandro Piras, Brad Beveridge, Jason Spiro
  4. ;;
  5. ;; Version: 0.1.2+svn
  6. ;; Authors: Alessandro Piras <laynor@gmail.com>,
  7. ;;          Brad Beveridge <brad.beveridge@gmail.com>
  8. ;; Previous maintainer: Jason Spiro <http://www.jspiro.com>
  9. ;; Maintainer: No maintainer anymore. Got a patch? See below.
  10. ;; URL: http://emacswiki.org/elisp/viper-in-more-modes.el
  11. ;;
  12. ;; This file is not part of GNU Emacs.
  13.  
  14. ;; This code is unmaintained.  Subscribe to
  15. ;; http://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
  16. ;; and if you're lucky, a committer will commit your patch for you.
  17. ;; If you would like to step up as new maintainer, email implementations-list and a committer will gladly anoint you.
  18.  
  19. ;;; Commentary:
  20. ;;
  21. ;; This file is an unofficial add-on to viper-mode.  It currently
  22. ;; provides vi-like keymaps for emacs-lisp-mode, lisp-interaction-mode,
  23. ;; slime-repl-mode, and lisp-mode.  If you have any questions or
  24. ;; comments, please email the authors and maintainer.  We provide no
  25. ;; guarantee of help with such early code.  If you extended this file to
  26. ;; cover additional modes, we would be very grateful; please contact us.
  27. ;;
  28. ;; There are no installation instructions or usage instructions, but
  29. ;; we might be able to help you out if you contact us.  If you wrote
  30. ;; such instructions and added them to this wiki page, we would be very
  31. ;; appreciative.
  32. ;;
  33. ;; This is alpha-quality code.  If it works for you, we would
  34. ;; appreciate it if you let us know.
  35.  
  36. ;;; TODO:
  37. ;;
  38. ;; * We shouldn't use the "vimper" function-name prefix anywhere in
  39. ;; this file.  The word "vimper" is a leftover from back when
  40. ;; viper-in-more-modes was part of Vimpulse, and Vimpulse was
  41. ;; unreleased and didn't have a good name yet.  But
  42. ;; viper-in-more-modes is no longer part of Vimpulse.  It doesn't
  43. ;; require Vimpulse to load.  It does provide access to some Vimpulse
  44. ;; features like visual mode, but viper-in-more-modes does something
  45. ;; different than Vimpulse and so isn't shipped with Vimpulse.  So we
  46. ;; should pick a new prefix.
  47. ;;
  48. ;; * Rename viper-in-more-modes to something much shorter.  This will
  49. ;; not only give viper-in-more-modes a shorter name, but will also
  50. ;; instantly provide us with a better prefix.
  51. ;;
  52. ;; * Clean up the code in general: for example, the error messages
  53. ;; shouldn't include exclamation marks.  And the grammar and
  54. ;; capitalization in the comments should be improved.  Also, the boxed
  55. ;; comments probably don't have to be in boxes.
  56. ;;
  57. ;; * Submit it to M-x report-emacs-bug and ask them to please include
  58. ;; viper-in-more-modes as part of Viper.  If we can't reach some
  59. ;; contributors for copyright assignment, we'll probably have to
  60. ;; discard their contributions at this time, so we should probably
  61. ;; try to get all contributors' mailing addresses and phone numbers
  62. ;; as soon as they've contributed fifteen lines or more, in case
  63. ;; they later disappear.
  64.  
  65. ;;; Change Log:
  66. ;;
  67. ;; Version 0.1.2:  Removed some duplicate keybinding code.  Also,
  68. ;; slime-list-callees is now on the ">" key instead of on the "<" key
  69. ;; which was already taken. Thank you Stephen Bach <sjbach at comcast.net>.
  70. ;; Version 0.1.1:  Made viper-leader-char a var, not a const.  Thank you
  71. ;; John J Foerch <jjfoerch at earthlink.net>.
  72. ;; Version 0.1:  Initial upload to wiki.
  73.  
  74. ;;; License:
  75. ;;
  76. ;; This program is free software; you can redistribute it and/or modify it under
  77. ;; the terms of the GNU General Public License as published by the Free Software
  78. ;; Foundation; either version 2 of the License, or any later version.
  79. ;;
  80. ;; This program is distributed in the hope that it will be useful, but WITHOUT
  81. ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  82. ;; FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  83. ;; details.
  84. ;;
  85. ;; You should have received a copy of the GNU General Public License along with
  86. ;; this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  87. ;; Place - Suite 330, Boston, MA 02111-1307, USA.
  88.  
  89.  
  90.  
  91. ;; Begin utility code {{{
  92.  
  93. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  94. ;;; Macro workaround to make some commands ;;;
  95. ;;; work on the character the cursor is on ;;;
  96. ;;; too (eg. in visual mode pressing "d"   ;;;
  97. ;;; deletes also the char under the cursor ;;;
  98. ;;; (like in vim)                          ;;;
  99. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  100.  
  101. (defmacro do-one-char-forward (&rest body)
  102.   "Wraps the body between `forward-char' and `backward-char' to make commands
  103. work on closed parens like one can expect in vi."
  104.   `(progn
  105.      (forward-char)
  106.      ,@body
  107.      (backward-char)))
  108.  
  109. (defmacro def-simple-vimper-wrapper-ocf (name &rest body)
  110.   ";     Define a wrapper for a command to execute it as if the cursor was one
  111.   ; char forward the current position. Uses `do-one-char-forward'. Use it
  112.   ; like a defun without lambdalist.
  113.   ;
  114.   ;     For example, this:
  115.   ;
  116.   ; (def-simple-vimper-wrapper-ocf my-eval-last-sexp (eval-last-sexp))
  117.   ;
  118.   ;     expands to this:
  119.   ;
  120.   ; (defun my-eval-last-sexp ()
  121.   ;   (interactive)
  122.   ;   (do-one-char-forward
  123.   ;    (eval-last-sexp)))"
  124.   `(defun ,name ()
  125.      (interactive)
  126.      (do-one-char-forward
  127.       ,@body)))
  128.  
  129. ;; }}} End utility code
  130.  
  131.  
  132.  
  133. ;; Begin major mode keybinding code {{{
  134.  
  135. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  136. ;;;; Major mode keybindings and functions used by vimper  ;;;;
  137. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  138.  
  139. (defvar viper-leader-char " ")
  140. (defmacro vimper-defkey-l (map key func)
  141.   `(define-key ,map (concat viper-leader-char ,key) ,func))
  142.  
  143. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  144. ;;;     Emacs Lisp Mode - Viper Mappings       ;;;
  145. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  146.  
  147. ;;; Commands definitions (Almost all are work-arounds due to the fact that
  148. ;;;         Emacs wants the cursor to be _after_ the ")" to execute functions
  149. ;;;         on sexps. We use the `do-one-char-forward' utility macro here;
  150. ;;;         the macro is defined above.
  151. (defun vimper-eval-last-sexp (&optional eval-last-sexp-arg-internal)
  152.   (interactive)
  153.   (do-one-char-forward (eval-last-sexp eval-last-sexp-arg-internal)))
  154.  
  155. (defun vimper-eval-region (&optional arg)
  156.   (interactive "P")
  157.   (if (not vimpulse-visual-mode)
  158.       (message "Select the region in Visual Mode!")
  159.     (apply 'eval-region (append (vimpulse-get-vs-bounds) (list t)))
  160.     (vimpulse-visual-mode 'toggle)))
  161. (defun vimper-pp-eval-region ()
  162.   (interactive)
  163.   (message (pp-to-string (vimper-eval-region))))
  164. (defun vimper-pp-eval-last-sexp (&optional eval-last-sexp-arg-internal)
  165.   (interactive)
  166.   (do-one-char-forward (pp-eval-last-sexp eval-last-sexp-arg-internal)))
  167.  
  168. (defun vimper-pp-eval-defun ()
  169.   (interactive)
  170.   (pp-eval-expression (quote (eval-defun nil))))
  171.  
  172. ;; macroexpand command (macroexpands last sexp)
  173. (def-simple-vimper-wrapper-ocf vimper-macroexpand
  174.   (pp-eval-expression (quote (macroexpand (sexp-at-point)))))
  175. ;; macroexpand-all command (macroexpands-all last sexp)
  176. (def-simple-vimper-wrapper-ocf vimper-macroexpand-all
  177.   (pp-eval-expression (quote (macroexpand-all (sexp-at-point)))))
  178.  
  179. ;;; bindings
  180. (setq my-elisp-modified-vi-map
  181.       (let ((map (make-sparse-keymap)))
  182.         ;; PP-Evaluate
  183.         (vimper-defkey-l map "pe" 'vimper-pp-eval-last-sexp)
  184.         (vimper-defkey-l map "pt" 'vimper-pp-eval-defun)
  185.         (vimper-defkey-l map "pr" 'vimper-pp-eval-region)
  186.         (vimper-defkey-l map "pE" 'pp-eval-expression)
  187.         ;; Evaluate
  188.         (vimper-defkey-l map "e" 'vimper-eval-last-sexp)
  189.         (vimper-defkey-l map "t" 'eval-defun)
  190.         (vimper-defkey-l map "r" 'vimper-eval-region)
  191.         (vimper-defkey-l map "E"  'eval-expression)
  192.         ;; Describe
  193.         (vimper-defkey-l map "da" 'apropos)
  194.         (vimper-defkey-l map "df" 'describe-function)
  195.         (vimper-defkey-l map "dv" 'describe-variable)
  196.         (vimper-defkey-l map "m" 'vimper-macroexpand)
  197.         (vimper-defkey-l map "M" 'vimper-macroexpand-all)
  198.         (vimper-defkey-l map "B" 'byte-compile-file)
  199.         map))
  200. (viper-modify-major-mode 'emacs-lisp-mode 'vi-state my-elisp-modified-vi-map)
  201. (viper-modify-major-mode 'lisp-interaction-mode 'vi-state my-elisp-modified-vi-map)
  202.  
  203. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  204. ;;;     Common Lisp Mode - Viper Mappings      ;;;
  205. ;;;                    Slime                   ;;;
  206. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  207.  
  208. ;; Commands
  209. (def-simple-vimper-wrapper-ocf vimper-slime-compile-defun
  210.   (slime-compile-defun))
  211. (def-simple-vimper-wrapper-ocf vimper-slime-eval-defun
  212.   (slime-eval-defun))
  213. (def-simple-vimper-wrapper-ocf vimper-slime-eval-last-expression
  214.   (slime-eval-last-expression))
  215. (def-simple-vimper-wrapper-ocf vimper-slime-pprint-eval-last-expression
  216.   (slime-pprint-eval-last-expression))
  217. (defun vimper-slime-eval-region ()
  218.   (interactive)
  219.   (if (not vimpulse-visual-mode)
  220.       (message "Select the region in Visual Mode!")
  221.     (slime-eval-region (min (mark) (point)) (max (mark) (point)))
  222.     (vimpulse-visual-mode 'toggle)))
  223. (defun vimper-slime-macroexpand-1 (&optional REPEATEDLY)
  224.   (interactive "P")
  225.   (do-one-char-forward
  226.    (slime-macroexpand-1 REPEATEDLY)))
  227. (def-simple-vimper-wrapper-ocf vimper-slime-macroexpand-all
  228.   (slime-macroexpand-all))
  229. ;; Bindings
  230.  
  231. ;; In general the Viper Slime mappings are much the same as regular Slime bindings,
  232. ;; The C-c and C-x prefixes are dropped.
  233. ;; When commands are similar, we use a lower case letter for the C-<key> case and an upper
  234. ;; case letter for the M-<key>, such as:
  235. ;; C-c C-k : slime-compile-and-load-file  : (vip-slime-leader k)
  236. ;; C-c M-k : slime-compile-file           : (vip-slime-leader K)
  237. ;; All commands begin with vip-slime-leader, which defaults to <space>
  238. ;; the M-x commands are not mapped, as they are presumably rare
  239. ;; Some keys are a triple key sequence.  The second key is a marker for a category
  240. ;; the third key is the activation key.
  241.  
  242. (setq my-lisp-modified-vi-map (let ((map (make-sparse-keymap)))
  243.                                 ;; Compilation Commands
  244.                                 (vimper-defkey-l map "k" 'slime-compile-and-load-file)
  245.                                 (vimper-defkey-l map "K" 'slime-compile-file)
  246.                                 (vimper-defkey-l map "c" 'vimper-slime-compile-defun)
  247.                                 (vimper-defkey-l map "C" 'slime-remove-notes)
  248.  
  249.                                 ;; Do I want to change those??? Meta key -_-''
  250.                                 ;; TODO: of course I want to change theese!! we're using
  251.                                 ;;       leader char here, so it definately sucks!!
  252.                                 ;; Finding definitions (they are same as Slime default)
  253.                                 (vimper-defkey-l map "M-." 'slime-edit-definition)
  254.                                 (vimper-defkey-l map "M-," 'slime-pop-find-definition-stack)
  255.                                 ;; Note handling has the same binding as Slime defaults
  256.                                 (vimper-defkey-l map "M-n" 'slime-next-note)
  257.                                 (vimper-defkey-l map "M-p" 'slime-previous-note)
  258.  
  259.                                 ;; Lisp Evaluation
  260.                                 (vimper-defkey-l map "x" 'vimper-slime-eval-defun)
  261.                                 (vimper-defkey-l map "e" 'vimper-slime-eval-last-expression)
  262.                                 (vimper-defkey-l map "p" 'vimper-slime-pprint-eval-last-expression)
  263.                                 (vimper-defkey-l map "r" 'vimper-slime-eval-region) ; watch for visual mode!!
  264.                                 ;; Lisp Documentation
  265.                                 ;; 3 key sequences
  266.                                 (vimper-defkey-l map "dd" 'slime-describe-symbol)
  267.                                 (vimper-defkey-l map "da" 'slime-apropos)
  268.                                 (vimper-defkey-l map "dz" 'slime-apropos-all)
  269.                                 (vimper-defkey-l map "dp" 'slime-apropos-package)
  270.                                 (vimper-defkey-l map "dh" 'slime-hyperspec-lookup)
  271.                                 (vimper-defkey-l map "d~" 'common-lisp-hyperspec-format)
  272.                                 ;; Macro expansion
  273.                                 (vimper-defkey-l map "m" 'vimper-slime-macroexpand-1)
  274.                                 (vimper-defkey-l map "M" 'vimper-slime-macroexpand-all)
  275.                                 (vimper-defkey-l map "t" 'slime-toggle-trace-fdefinition)
  276.  
  277.                                 ;; Disassembly
  278.                                 (vimper-defkey-l map "D" 'slime-disassemble-symbol)
  279.  
  280.                                 ;; Abort/Recovery
  281.                                 (vimper-defkey-l map "b" 'slime-interrupt)
  282.                                 (vimper-defkey-l map "~" 'slime-sync-package-and-default-directory)
  283.                                 (vimper-defkey-l map "P" 'slime-repl-set-package)
  284.  
  285.                                 ;; Cross-reference
  286.  
  287.                                 ;; All cross-reference functions are
  288.                                 ;; triple key sequences
  289.                                 ;; (vip-slime-leader ?w key)
  290.                                 (vimper-defkey-l map "wc" 'slime-who-calls)
  291.                                 (vimper-defkey-l map "wr" 'slime-who-references)
  292.                                 (vimper-defkey-l map "wb" 'slime-who-binds)
  293.                                 (vimper-defkey-l map "ws" 'slime-who-sets)
  294.                                 (vimper-defkey-l map "wm" 'slime-who-macroexpands)
  295.                                 (vimper-defkey-l map "<" 'slime-list-callers)
  296.                                 (vimper-defkey-l map ">" 'slime-list-callees)
  297.  
  298.                                 ;; Inspector
  299.                                 (vimper-defkey-l map "i" 'slime-inspect)
  300.  
  301.                                 ;;Repl!
  302.                                 (vimper-defkey-l map "R" 'slime-switch-to-output-buffer)
  303.                                 (vimper-defkey-l map "z" 'slime-switch-to-output-buffer)
  304.  
  305.                                 ;; Profiler
  306.                                 ;; "p" is already taken as a key, we
  307.                                 ;; use "f" to access the profiler functions
  308.                                 (vimper-defkey-l map "f" (make-sparse-keymap))
  309.                                 (vimper-defkey-l map "ft" 'slime-toggle-profile-fdefinition)
  310.                                 (vimper-defkey-l map "fp" 'slime-profile-package)
  311.                                 (vimper-defkey-l map "fu" 'slime-unprofile-all)
  312.                                 (vimper-defkey-l map "fr" 'slime-profile-report)
  313.                                 (vimper-defkey-l map "fR" 'slime-profile-reset)
  314.                                 map))
  315.  
  316. (viper-modify-major-mode 'lisp-mode 'vi-state my-lisp-modified-vi-map)
  317.  
  318. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  319. ;;; Clojure Mode - Viper Mappings ;;;
  320. ;;;            Slime              ;;;
  321. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  322.  
  323.  
  324. ;; From http://bc.tech.coop/blog/081120.html
  325.  
  326. (defun slime-java-describe (symbol-name)
  327.   "Get details on Java class/instance at point."
  328.   (interactive (list (slime-read-symbol-name "Java Class/instance: ")))
  329.   (when (not symbol-name)
  330.     (error "No symbol given"))
  331.   (save-excursion
  332.     (set-buffer (slime-output-buffer))
  333.     (unless (eq (current-buffer) (window-buffer))
  334.       (pop-to-buffer (current-buffer) t))
  335.     (goto-char (point-max))
  336.     (insert (concat "(show " symbol-name ")"))
  337.     (when symbol-name
  338.       (slime-repl-return)
  339.       (other-window 1))))
  340.  
  341. (setq my-clojure-modified-vi-map (let ((map (make-sparse-keymap)))
  342.                                    ;; Compilation Commands - Perfeito
  343.                                    (vimper-defkey-l map "k" 'slime-compile-and-load-file)
  344.                                    (vimper-defkey-l map "K" 'slime-compile-file)
  345.                                    (vimper-defkey-l map "c" 'vimper-slime-compile-defun)
  346.                                    (vimper-defkey-l map "C" 'slime-remove-notes)
  347.  
  348.                                    ;; Do I want to change those??? Meta key -_-''
  349.                                    ;; TODO: of course I want to change theese!! we're using
  350.                                    ;;       leader char here, so it definately sucks!!
  351.                                    ;; Finding definitions (they are same as Slime default)
  352.                                    (vimper-defkey-l map "M-." 'slime-edit-definition)
  353.                                    (vimper-defkey-l map "M-," 'slime-pop-find-definition-stack)
  354.                                    ;; Note handling has the same binding as Slime defaults
  355.                                    (vimper-defkey-l map "M-n" 'slime-next-note)
  356.                                    (vimper-defkey-l map "M-p" 'slime-previous-note)
  357.  
  358.                                    ;; Lisp Documentation
  359.  
  360.                                    ;; 3 key sequences - Perfeito
  361.                                    (vimper-defkey-l map "dd" 'slime-describe-symbol)
  362.                                    (vimper-defkey-l map "da" 'slime-apropos)
  363.                                    (vimper-defkey-l map "dz" 'slime-apropos-all)
  364.                                    (vimper-defkey-l map "dp" 'slime-apropos-package)
  365.  
  366.                                    ;; Java stuff
  367.                                    (vimper-defkey-l map "jj" 'slime-java-describe)
  368.                                    (vimper-defkey-l map "jd" 'swank-clojure-javadoc)
  369.                                    
  370.                                    ;; Macro expansion - Funcionando
  371.                                    (vimper-defkey-l map "m" 'vimper-slime-macroexpand-1)
  372.                                    (vimper-defkey-l map "M" 'vimper-slime-macroexpand-all)
  373.                                    (vimper-defkey-l map "t" 'slime-toggle-trace-fdefinition)
  374.  
  375.                                    ;; Disassembly ALL!
  376.                                    (vimper-defkey-l map "D" 'slime-disassemble-symbol)
  377.  
  378.                                    ;; Abort/Recovery 0 1
  379.                                    (vimper-defkey-l map "b" 'slime-interrupt)
  380.                                    (vimper-defkey-l map "~" 'slime-sync-package-and-default-directory)
  381.                                    (vimper-defkey-l map "P" 'slime-repl-set-package)
  382.  
  383.                                    ;; Cross-reference
  384.  
  385.                                    ;; All cross-reference functions are
  386.                                    ;; triple key sequences
  387.                                    ;; (vip-slime-leader ?w key) ALL!
  388.                                    (vimper-defkey-l map "wc" 'slime-who-calls)
  389.                                    (vimper-defkey-l map "wr" 'slime-who-references)
  390.                                    (vimper-defkey-l map "wb" 'slime-who-binds)
  391.                                    (vimper-defkey-l map "ws" 'slime-who-sets)
  392.                                    (vimper-defkey-l map "wm" 'slime-who-macroexpands)
  393.                                    (vimper-defkey-l map "<" 'slime-list-callers)
  394.                                    (vimper-defkey-l map ">" 'slime-list-callees)
  395.  
  396.                                    ;; Inspector ALL!
  397.                                    (vimper-defkey-l map "i" 'slime-inspect)
  398.  
  399.                                    ;;Repl! (all!)
  400.                                    (vimper-defkey-l map "R" 'slime-switch-to-output-buffer)
  401.                                    (vimper-defkey-l map "z" 'slime-switch-to-output-buffer)
  402.  
  403.                                    ;; Profiler
  404.                                    ;; "p" is already taken as a key, we
  405.                                    ;; use "f" to access the profiler functions
  406.                                    (vimper-defkey-l map "f" (make-sparse-keymap))
  407.                                    (vimper-defkey-l map "ft" 'slime-toggle-profile-fdefinition)
  408.                                    (vimper-defkey-l map "fp" 'slime-profile-package)
  409.                                    (vimper-defkey-l map "fu" 'slime-unprofile-all)
  410.                                    (vimper-defkey-l map "fr" 'slime-profile-report)
  411.                                    (vimper-defkey-l map "fR" 'slime-profile-reset)
  412.                                    map))
  413.  
  414. (viper-modify-major-mode 'clojure-mode 'vi-state my-clojure-modified-vi-map)
  415.  
  416.  
  417. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  418. ;;;   Slime Inspector Mode - Viper Mappings    ;;;
  419. ;;;                    Slime                   ;;;
  420. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  421.  
  422. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  423. ;;;   Slime   REPL    Mode - Viper Mappings    ;;;
  424. ;;;                    Slime                   ;;;
  425. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  426.  
  427. (setq my-repl-modified-vi-map (let ((map (make-sparse-keymap)))
  428.                                 (vimper-defkey-l map "m" 'vimper-slime-macroexpand-1)
  429.                                 (vimper-defkey-l map "i" 'slime-inspect)
  430.                                 (vimper-defkey-l map "<C-return>" 'slime-repl-closing-return)
  431.                                 (vimper-defkey-l map "G" 'end-of-buffer)))
  432. (viper-modify-major-mode 'slime-repl-mode 'vi-state my-repl-modified-vi-map)
  433.  
  434. (setq my-repl-modified-insert-map (let ((map (make-sparse-keymap)))
  435.                                     (vimper-defkey-l map "<C-return>"
  436.                                                      'slime-repl-closing-return)))
  437.  
  438. (viper-modify-major-mode 'slime-repl-mode 'insert-state
  439.                          my-repl-modified-insert-map)
  440.  
  441. ;; }}} End major mode keybinding code
  442.  
  443. ;;;;;;;;;;;;;;;;;;
  444. ;; IBuffer mode ;;
  445. ;;;;;;;;;;;;;;;;;;
  446.  
  447. ;;; bindings
  448. (require 'ibuffer)
  449. (let ((map ibuffer-mode-map))
  450.   (define-key map (kbd "j") 'ibuffer-forward-line)
  451.   (define-key map (kbd "J") 'ibuffer-jump-to-buffer)
  452.   (define-key map (kbd "k") 'ibuffer-backward-line)
  453.   (define-key map (kbd "K") 'ibuffer-do-kill-lines))
  454.  
  455.  
  456. ;;;;;;;;;;;;;;;
  457. ;; Help mode ;;
  458. ;;;;;;;;;;;;;;;
  459.  
  460.                                         ; (setq my-help-modified-vi-map
  461.                                         ;       (let ((map (make-sparse-keymap)))
  462.                                         ;         ;; Bindings that do not use the leader character
  463.                                         ;       (define-key map "d" 'ibuffer-mark-for-delete)
  464.                                         ;       map))
  465.                                         ; (add-hook 'help-mode-hook  '(lambda ()
  466.                                         ;                                  (viper-mode)
  467.                                         ;                                  (viper-modify-major-mode 'ibuffer-mode 'vi-state my-ibuffer-modified-vi-map)))
  468.  
  469.  
  470. (provide 'viper-in-more-modes)
  471.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement