0

I would like to be able to leave the insert state (I think that's what it's called in emacs?) using the Ctrl+c combination I know from vim. I'm using doom-emacs in case that's important, and I'm completely new to emacs.

1
  • 1
    Let me suggest you find a different keybinding to exit insert state (or just use esc). Emacs uses the C-c prefix for countless keybindings, and if you override it, you'll clobber a lot of functionality – Dan Nov 30 '20 at 2:20
1

Ex-vimmer also. As Dan pointed out in the comment of OP, binding to C-c is too devastating in emacs. What I do is instead binding to C-c C-c so I can hit C-c like a crazy person to get back to normal. (Just like hitting C-s 10 times is the proper way to save MS Word documents, I do this a lot: C-c C-c C-c ... C-c C-g C-g ... C-g to make sure I'm in normal state)

(define-key evil-insert-state-map (kbd "C-c C-c") 'evil-normal-state)
(define-key evil-normal-state-map (kbd "C-c C-c") 'evil-normal-state)

Note, this has a downside though (not very serious or often encounterd), is that you would override some useful C-c C-c bindings from famous packages, like org-ctrl-c-ctrl-c in org-mode, as well as several cases for magit. It's not serious in the sense that I use Spacemacs which also binds these common C-c C-c cases to , , for evil-normal-state, so I'm not really missing anything important. In your case you are using doom-emacs, which is somewhat influenced by Spacemacs, it might also have provided a nice keybinding alternative already. If not, nothing can stop you from rebinding some C-c C-c cases yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.