emacsviper-modevipervimpulse

remapping <space> and <backspace> in Vimpulse to scroll more


In Some Thoughts on Emacs and Vim, Shinobu recommendation to remap <space> and <backspace> doesn't work on Emacs 2.3.1 with Vimpulse 0.5.

What am I doing wrong?

;; from .emacs

; simulate vim's "nnoremap <space> 10<c-e>10j"
(vimpulse-map " " (lambda ()
                     (interactive)
                     (next-line 10)
                     (viper-scroll-up-one 10)
                     ))

; simulate vim's "nnoremap <backspace> 10<c-y>10k"
(define-key viper-vi-global-user-map [backspace] (lambda ()
                     (interactive)
                     (previous-line 10)
                     (viper-scroll-down-one 10)
                     ))

Solution

  • It'd help to know what isn't working.

    The following works for me, as in SPC and backspace scroll by 10 when in command mode (Vi state):

    (define-key viper-vi-global-user-map [backspace]
      (lambda ()
        (interactive)
        (previous-line 10)
        (viper-scroll-down-one 10)))
    
    (define-key viper-vi-global-user-map (kbd "SPC")
      (lambda ()
        (interactive)
        (next-line 10)
        (viper-scroll-up-one 10)))
    

    That's using vimpulse.el version 0.5 and viper-expert-level 5.