emacsviperviper-mode

viper-mode changes <delete> key


I want to use the <delete> key (C-d, I think) for forward-deletion in viper-mode.

Before starting viper-mode, <delete> works correctly. In viper-mode, <delete> jumps to the buffer's last line.

I have added (setq viper-ex-style-editing nil) to .viper and <backspace> works in all modes.


Solution

  • Try this:

    (define-key viper-vi-basic-map "\C-d" 'viper-delete-char)
    (define-key viper-insert-basic-map "\C-d" 'viper-delete-char)
    

    Now, that uses the viper-delete-char command to be consistent with viper. If you want the regular emacs deletion behavior, use delete-char instead.

    viper is implemented using a bunch of different keymaps, and figuring out which ones to modify is tricky. The easiest way (usually) is to just look at the source code. So you could start with M-x find-library viper. Note: Most keymaps are actually defined in the library viper-cmd.