emacsviper-mode

Issuing ElScreen's prefix key while in viper mode


I would like to use ElScreen in conjunction with viper & vimpulse. Here's how I have configured both packages in my .emacs file:

(load "elscreen" "ElScreen" t)
(elscreen-set-prefix-key "\C-\\")

(setq viper-inhibit-startup-message t)
(setq viper-expert-level '5)
(setq viper-mode t)
(require 'vimpulse)

I cannot issue commands to ElScreen while in V or I states; I have to switch to the E state first. In order to create a screen, I have to type: C-z C-\ c. Once I'm done with creating a screen, I have to switch back to V by typing C-z again. How can I configure .emacs so that I can issue commands directly to ElScreen without having to switch to the E mode? I'm using Emacs 23.3.1.


Solution

  • After hours of reading ElScreen's & Vimpulse's source code and reading up on a multitude of Elisp keybinding functions, I was able to get it to work. Insert this in your .emacs file after loading ElScreen & Vimpulse. Exclude the second line if you don't want to have ElScreen commands available in insert mode. This can be helpful if your prefix key is something that can be entered into a buffer in insert mode. (I set my prefix key to `, which is a character that can typically be entered into a buffer, as opposed to, say, C-b.)

    (define-key viper-vi-global-user-map elscreen-prefix-key elscreen-map)
    (define-key viper-insert-global-user-map elscreen-prefix-key elscreen-map)