[implementations-list] [PATCH] Define a proper prefix command for the "\C-w" map.

Štěpán Němec stepnem at gmail.com
Tue May 11 19:14:54 CEST 2010


This makes customization and rebinding possible.
---
Example (why I felt the need):
Now I can

  (eval-after-load 'vimpulse
    '(define-key term-raw-escape-map "\C-w" 'vimpulse-window-map))

to be able to use Vimpulse window bindings in Emacs' term modes.

 vimpulse-misc-keybindings.el |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/vimpulse-misc-keybindings.el b/vimpulse-misc-keybindings.el
index 3a6c723..49f25d9 100644
--- a/vimpulse-misc-keybindings.el
+++ b/vimpulse-misc-keybindings.el
@@ -64,19 +64,20 @@
   (define-key viper-vi-basic-map "\C-r" 'redo)))
 
 ;; Window manipulation
-(define-key viper-vi-basic-map "\C-w" (make-sparse-keymap))
-(define-key viper-vi-basic-map "\C-w\C-w" 'vimpulse-cycle-windows)
-(define-key viper-vi-basic-map "\C-ww" 'vimpulse-cycle-windows)
-(define-key viper-vi-basic-map "\C-wo" 'delete-other-windows)
-(define-key viper-vi-basic-map "\C-wc" 'delete-window)
-(define-key viper-vi-basic-map "\C-ws" 'split-window-vertically)
-(define-key viper-vi-basic-map "\C-wv" 'split-window-horizontally)
+(define-prefix-command 'vimpulse-window-map)
+(define-key viper-vi-basic-map "\C-w" 'vimpulse-window-map)
+(define-key vimpulse-window-map "\C-w" 'vimpulse-cycle-windows)
+(define-key vimpulse-window-map "w" 'vimpulse-cycle-windows)
+(define-key vimpulse-window-map "o" 'delete-other-windows)
+(define-key vimpulse-window-map "c" 'delete-window)
+(define-key vimpulse-window-map "s" 'split-window-vertically)
+(define-key vimpulse-window-map "v" 'split-window-horizontally)
 
 (when (fboundp 'windmove-left)
-  (define-key viper-vi-basic-map "\C-wh" 'windmove-left)
-  (define-key viper-vi-basic-map "\C-wj" 'windmove-down)
-  (define-key viper-vi-basic-map "\C-wk" 'windmove-up)
-  (define-key viper-vi-basic-map "\C-wl" 'windmove-right))
+  (define-key vimpulse-window-map "h" 'windmove-left)
+  (define-key vimpulse-window-map "j" 'windmove-down)
+  (define-key vimpulse-window-map "k" 'windmove-up)
+  (define-key vimpulse-window-map "l" 'windmove-right))
 
 ;;; Insert mode keys
 
-- 
1.7.1




More information about the implementations-list mailing list