0

I have been using Emacs for a while and recently started using evil mode. I exclusively use emacs-nox (command line emacs).

The only thing that's missing for me is C-z to pause emacs and bring me back to my bash shell.

For some reason when evil mode is enabled, the C-z hotkey does nothing. When I disable evil mode, C-z works just fine. I have never used vi/m before, so I'm not sure if there is a vi/m specific command to pause (I'm pretty C-z in vi will pause it as well). I understand that C-z is a bash command, not an Emacs hotkey. I'm not sure why it is interrupted by evil mode.

1

I'm not sure why it is interrupted by evil mode.

It's interrupted by evil mode to switch into the "emacs" state, a mode where evil falls back into your regular Emacs keybindings:

(describe-key "\C-z")

C-z runs the command evil-emacs-state (found in evil-motion-state-map), which is an interactive compiled Lisp function in ‘evil-states.el’.

It is bound to C-z.

(evil-emacs-state &optional ARG)

Enable Emacs state. Disable with negative ARG. If ARG is nil, don’t display a message in the echo area.

However, suspend-frame is also bound to C-x C-z, see (describe-function 'suspend-frame). This keybinding is not changed by evil mode.

2
  • Thank you very much for the response. It was super helpful. I never use evil-emacs-state. What would be the best way for me to remap C-z to suspend-frame in all states? – marc.soda Nov 19 '20 at 21:41
  • Update: to override this keybinding add (define-key evil-motion-state-map (kbd "C-z") 'suspend-frame) to your emacs init file. Thanks again @Zeta! – marc.soda Nov 19 '20 at 21:54

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.