开发者

Invoke single normal-mode command with Ctrl-o in Vimpulse?

The usual behavior in vim is for C-o in insert-mode to allow the user to use one normal-mode command and then return to insert-mode.

Following the suggestions in this comment, I've set

(vimpulse-imap "\C-o" 'viper-escape-to-vi)

But when I press C-o in insert-mode, the characters "^O" are inserted in the buffer and I am unable to switch to normal-mode for one command as I expect. I understand viper-escape-to-vi is bound to C-z by default but I am also unable to switch to normal-mode using this key combination either ("^Z" is printed in the buffer instead). What am I doing wrong?

Also, second question: I would like for C-z to not be bound by viper-mode (or vimpulse) as I use it for elscreen. How can I tell it to leave C-z alone?

Edit: Found this bit of code in vimpulse-misc-keybindings.el:

;; temporarily escape to vi state
(define-key viper-inse开发者_如何学运维rt-basic-map "\C-o" 'viper-escape-to-vi)

So should be defined already? Not sure why it doesn't work.


Ad 1) It works for me, maybe something went wrong with your config?

But the output is strange: The only way to get it is a quoted-insert (or similar).

viper-escape-to-vi in insert state is bound to viper-toggle-key (but well that defaults to C-z), so see below. Again your output is strange.

Ad 2) You have to set viper-toggle-key to a sexp before viper is loaded, alternatively customize it.

For the former (using the Pause key for it)

(setq viper-toggle-key [pause])
(require 'viper)

You should try evil, being the successor to vimpulse. It's coming along well and gets rid of viper.

Setting the toggle key there (to pause again) is a (evil-set-toggle-key "<pause>") away, it's a kbd sequence not a sexp. C-o works fine, too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜