2
votes

editor: Emacs 24.2; plugin: evil; platform: windows 8

I want to use C-o to normal-mode, and gg to the beginning, but after using gg, the buffer automatically come back into emacs-mode.

For example:

(1) If I am in emacs mode, and I want to jump to the beginning-of-buffer with gg

(2) I can do it like this, C-z to normal-mode, then gg to the beginning, then C-z to emacs mode.

(3) I don't like this way, if I am in emacs-mode, I want to use C-o to normal-mode, and gg to the beginning, but after using gg, the buffer automatically come back into emacs-mode.

(4) And I think that would be a great convenient for me,I can also use C-o dib to delete contents in brackets without leaving emacs-mode(because after C-o dib, the buffer automatically back into emacs-mode).

I got an answer from the evil mailing list, and it works well!

(define-key evil-emacs-state-map (kbd "C-o") 'evil-execute-in-normal-state)
1
It would help if you clearly state which editor, version, and mode you're using, and what your particular problem is.Ingo Karkat

1 Answers

0
votes

This behavior seems consistent with Vim's behavior: <C-o> is used to execute one normal mode command and immediately return to insert mode.

Technically, it can be used to issue a :norm Ex-command with a bunch of normal mode commands after it but there would be no benefit, I guess, and I have no idea if Evil does :normal anyway. You might as well leave insert mode completely.

Which is entirely the point of modality and Vim in the first place. If you use Evil, you might as well embrace this mode of thinking rather than fighting against it.